Wikimedia sync script
This page is obsolete. It is being retained for archival purposes. It may document extensions or features that are obsolete and/or no longer supported. Do not rely on the information here being up-to-date. |
It is possible to keep your MediaWiki install automatically synced with the Wikimedia wikis by way of a script. This can be a good idea because your wikis are automatically up to date and you will have the same functionality as the Wikimedia wikis (without the terror of absolute bleeding edge).
- Save the script below as
wikimediaupdate.pl
chmod +x wikimediaupdate.pl
- Add a job to your crontab for it to run as often as you want (once a day should be fine):
0 3 * * * /path/to/wikimediaupdate.pl
It's probably a good idea to add a script that creates backups on a regular basis as well…
Script
editBy Andrew Garrett, under a "do whatever you want with it" license:
#!/usr/bin/perl -w
use LWP::Simple;
my $text = get 'http://en.wikipedia.org/w/api.php?action=query&meta=siteinfo&format=txt';
if ($text =~ /\[rev\] \=\> (\d+)/) {
$rev = $1;
} else {
die "Can't get Wikimedia's SVN revision";
}
print "Updating to r$rev\n";
`svn up /path/to/base/of/mediawiki/install/ -r $rev`;
`php /path/to/base/of/mediawiki/install/maintenance/update.php`;