Put both files in the same directory. Execute the downloader - script
/bin/bash typo3_download_latest.sh
The script will check, if the downloaded file exists already, if not download it.
So you could easily run this a daily cron.
| #!/usr/bin/php | |
| <?php | |
| /*** | |
| * | |
| * check getopts | |
| * | |
| ***/ | |
| $typo3version='4.5'; | |
| // show only release version | |
| $longopts = array("releaseonly","typo3version::"); | |
| $options = getopt("r",$longopts); | |
| if (isset($options['typo3version'])){ | |
| switch ($options['typo3version']){ | |
| case '6.2': | |
| $typo3version = $options['typo3version']; | |
| break; | |
| } | |
| } | |
| $json = file_get_contents('http://get.typo3.org/json'); | |
| $data = json_decode($json,true); | |
| $version=$data[$typo3version]["latest"]; | |
| if ($version != ""){ | |
| $arr=explode(".",$version); | |
| $version_releaseonly=$arr[2]; | |
| } | |
| // something went wrong | |
| else { | |
| exit (1); | |
| } | |
| if (isset($options["releaseonly"])){ | |
| echo $version_releaseonly; | |
| exit (0); | |
| } | |
| if (isset($options["r"])){ | |
| echo $version_releaseonly; | |
| exit (0); | |
| } | |
| echo $version; | |
| ?> |
| #!/bin/bash | |
| PHP=$(which php) | |
| DEST_DIR=/usr/src | |
| DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | |
| if [ "$1" != "" ] | |
| then | |
| DEST_DIR=$1 | |
| fi | |
| TYPO3_VERSION=$($PHP $DIR"/t3x_showlatest.php" --typo3version=6.2) | |
| WGET=$(which wget) | |
| if [ "$WGET" == "" ] | |
| then | |
| echo "Sorry. Wget is not installed. Giving up" | |
| fi | |
| if [ ! -f $DEST_DIR/typo3_src-${TYPO3_VERSION}.tar.gz ] | |
| then | |
| $WGET get.typo3.org/$TYPO3_VERSION -O $DEST_DIR/typo3_src-${TYPO3_VERSION}.tar.gz | |
| DONE=$? | |
| else | |
| DONE=0 | |
| fi | |
| exit $DONE | |