Created
June 29, 2016 11:23
-
-
Save TimKraemer/a44d02318867fde500364624ca44dea2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# automagically downloads the newest stable mediawiki and it's php dependencies | |
MW_PATH="/export/home/wwwfsr/fachschaft/wiki" # set your mediawiki path here | |
MW_stable_branch_number=$(curl -s "https://www.mediawiki.org/w/api.php?action=expandtemplates&text=\{\{MW%20stable%20branch%20number\}\}&prop=wikitext&formatversion=2&format=json" | python -c 'import json,sys;obj=json.load(sys.stdin);print obj["expandtemplates"]["wikitext"]') | |
MW_stable_release_number=$(curl -s "https://www.mediawiki.org/w/api.php?action=expandtemplates&text=\{\{MW%20stable%20release%20number\}\}&prop=wikitext&formatversion=2&format=json" | python -c 'import json,sys;obj=json.load(sys.stdin);print obj["expandtemplates"]["wikitext"]') | |
wget "http://releases.wikimedia.org/mediawiki/$MW_stable_branch_number/mediawiki-$MW_stable_release_number.tar.gz" -P /tmp/ | |
tar -xzf "/tmp/mediawiki-$MW_stable_release_number.tar.gz" -C $MW_PATH --strip-components=1 | |
rm "/tmp/mediawiki-$MW_stable_release_number.tar.gz" | |
# first, self-update composer | |
echo "updating composer and dependencies" | |
cd $MW_PATH | |
php composer.phar self-update | |
# run the composer update yourself (shouldn't be neccessary, since mediawikis update does this, I think) | |
#php composer.phar update | |
# then, update mediawiki database | |
php $MW_PATH/maintenance/update.php | |
# on this server, we had to comment out the FollowSymLinks directive for some reason | |
# (if we kept this directive, the webserver wasn't allowed to access the images) | |
# shouldn't be neccessary for the most configurations | |
# sed -i -e 's/Options +FollowSymLinks/\#Options +FollowSymLinks/g' $MW_PATH/images/.htaccess | |
echo "\033[0;32m MediaWiki update to $MW_stable_release_number complete! \033[0m" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment