MediaWiki/Backing up a wiki

< MediaWiki

XML dump
To create an XML dump of every revision of the text content of a wiki,
 * 1) Go to your maintenance directory in using the shell. Use PuTTY or another similar program.
 * 2) /usr/local/dh/cgi-system/php5.cgi dumpBackup.php --full --report > NameOfUrBackup.xml

XML dumps do not contain user accounts, user-uploaded images, image metadata, logs, etc.

SQL dump
Follow the directions at Backup MySQL. To summarize:

To dump the entire SQL database holding every revision of the text content of a wiki, plus user acounts, image metadata, logs, etc.,
 * 1) Go to your wiki directory in using the shell. Use PuTTY or another similar program.
 * 2) nice -n 19 mysqldump -u $USER --password="$PASSPHRASE" $DATABASE -c | nice -n 19 gzip -9 > ~/backup/wiki-$DATABASE-$(date '+%Y%m%d').sql.gz
 * 3) consider putting the above command in your crontab.

SQL dumps do not contain user-uploaded images.

image backup
To backup the user-uploaded images (jpeg, gif, svg, etc.) (all in the "images" folder),
 * 1) Go to your wiki directory in using the shell. Use PuTTY or another similar program.
 * 2) tar cvhf wiki-tar-images-$(date '+%Y-%m-%d').tar images
 * 3) consider putting the above command in your crontab.