- #!/bin/sh
- binDir=/usr/bin/
- sleep=2
- pageCacheTables=(
- cache_pages
- cache_pagesection
- )
- sites=(
- /var/www/sites/live/www.somedomain.tld
- /var/www/sites/live/www.someotherdomain.tld
- /var/www/sites/live/www.yetsomeotherdomain.tld
- )
- len=${#sites[*]}
- pageCacheTablesLength=${#pageCacheTables[*]}
- i=0
- while [ $i -lt $len ]; do
- echo updating: ${sites[$i]}
- cd ${sites[$i]}
- rm typo3_src
- ln -s ../../sources/typo3_src-4.2.5 typo3_src
- echo generating new key
- k=0
- key=''
- while [ $k -lt 96 ]; do
- key=$key$(head -100 /dev/urandom | md5sum | cut -c1)
- let k++
- done
- echo key: $key
- sed -i "s/\(\$TYPO3_CONF_VARS\['SYS']\['encryptionKey'] = \).*/\1'$key';/g" typo3conf/localconf.php
- echo removing configuration cache
- rm -f typo3conf/temp_CACHED*
- echo clearing page cache
- # For some insane reason some values are enclosed in double qotes
- database=$(grep "typo_db " typo3conf/localconf.php | tail -1 | sed "s/^[^']*'\([^']*\)'.*/\1/" | grep '$typo_db =')
- if [ -z "$database" ] ; then
- database=$(grep "typo_db " typo3conf/localconf.php | tail -1 | sed "s/^[^']*'\([^']*\)'.*/\1/")
- else
- database=$(grep "typo_db " typo3conf/localconf.php | tail -1 | sed "s/^[^\"]*\"\([^\"]*\)\".*/\1/")
- fi
- username=$(grep "typo_db_username " typo3conf/localconf.php | tail -1 | sed "s/^[^']*'\([^']*\)'.*/\1/" | grep '$typo_db_username =')
- if [ -z "$username" ] ; then
- username=$(grep "typo_db_username " typo3conf/localconf.php | tail -1 | sed "s/^[^']*'\([^']*\)'.*/\1/")
- else
- username=$(grep "typo_db_username " typo3conf/localconf.php | tail -1 | sed "s/^[^\"]*\"\([^\"]*\)\".*/\1/")
- fi
- password=$(grep "typo_db_password " typo3conf/localconf.php | tail -1 | sed "s/^[^']*'\([^']*\)'.*/\1/" | grep '$typo_db_password =')
- if [ -z "$password" ] ; then
- password=$(grep "typo_db_password " typo3conf/localconf.php | tail -1 | sed "s/^[^']*'\([^']*\)'.*/\1/")
- else
- password=$(grep "typo_db_password " typo3conf/localconf.php | tail -1 | sed "s/^[^\"]*\"\([^\"]*\)\".*/\1/")
- fi
- j=0
- while [ $j -lt $pageCacheTablesLength ];
- do
- nice -n 19 ${binDir}mysql --batch -u$username -p"$password" -D$database -e "TRUNCATE ${pageCacheTables[$j]}"
- nice -n 19 ${binDir}mysql --batch -u$username -p"$password" -D$database -e "ALTER TABLE ${pageCacheTables[$j]} auto_increment=1"
- let j++
- done
- echo "done! Sleeping $sleep seconds . . ."
- sleep $sleep
- echo
- let i++
- done
Yesterday some updates came out for TYPO3. These updates fixed certain issues and we needed to update all of our excellent shared hosting environments.
We already have a script (which is more elaborate now) that checks all our TYPO3 installations and sends the sysadmins a nice report about its findings. We use part of that report (list of paths to Document Roots) to feed the updater script.
The TYPO3 update requires you to do the followi
- update encryption key
- clear configuration cache
- clear page cache
We do not want to go into 200+ TYPO3 backends and do those tasks manually. We are lazy and we will write a script to automagically do the boring tasks for us.
This script is not perfect but it works well on Debian systems. You can modify it to fit your needs. It was just a quick hack to ease the upgrade pain. Take care to switch the symlink part for upgrade runs of different versions of TYPO3.
I am not responsible for any damage to your system that may occur to misuse of this script. Make sure you understand it before you run it. Run it with a single URI before attempting a whole ist of URI's.
The highlighting script is not perfect yet when pasting in the RTE, please find a cut and paste version in the scripts section.
Happy upgrading!



http://www.abaton.at/support/typo3/typo3-update-script/
Script is called: get_typo3_update.sh
br, Christoph