This is an old revision of the document!
DokuWiki Upgrade
- upgrade-dokuwiki.sh
#!/bin/bash dokuwikiDir=data backupDir=backups releaseDir=releases deleteInstallPhp=true # Making sure directories exist [[ -d $backupDir ]] || mkdir $backupDir [[ -d $releaseDir ]] || mkdir $releaseDir curTime=$(date '+%F_%T' | tr -d ':') backupFile=$backupDir/${dokuwikiDir}_${curTime}_backup.tar.gz echo "Creating backup from ./$dokuwikiDir to ./$backupFile" tar --use-compress-program="pigz -9 -k" -cf $backupFile $dokuwikiDir echo "Getting version of stable release from download.dokuwiki.org" version=$(curl -s https://download.dokuwiki.org/ | grep "dokuwiki-stable.tgz" -A 1 | tail -n 1 | sed -E 's/.*hint">(.*) .*<\/span>.*/\1/') echo "Latest stable version is: $version" releaseFile=$releaseDir/dokuwiki-stable-$version.tgz echo "Fetching release to ./$releaseFile" wget -q https://download.dokuwiki.org/src/dokuwiki/dokuwiki-stable.tgz -O $releaseFile echo "Extracting tarball" tar zxf $releaseFile echo "Copying contents of new release" 'cp' -af dokuwiki-$version/* $dokuwikiDir echo "Deleting unused files" grep -Ev '^($|#)' $dokuwikiDir/data/deleted.files | xargs -n 1 rm -vf if [[ $deleteInstallPhp == "true" ]]; then echo "Deleting install.php" rm -f $dokuwikiDir/install.php fi echo "Fixing directory and file permissions" find data/ -type d -exec chown www-data:www-data {} \; find data/ -type f -exec chown www-data:www-data {} \; find data/ -type d -exec chmod 0755 {} \; find data/ -type f -exec chmod 0644 {} \; echo "Finished"