Regarding all software published on this site,
please note the software disclaimers page!
Here is a little script that can be used to create a backup of your MediaWiki installation:
#!/bin/sh #################################################################### # # # Basic Backup Script for MediaWiki. # # Created by Daniel Kinzler, brightbyte.de, 2008 # # # # This script may be freely used, copied, modified and distributed # # under the sole condition that credits to the original author # # remain intact. # # # # This script comes without any warranty, use it at your own risk. # # # #################################################################### ############################################### # CHANGE THESE OPTIONS TO MATCH YOUR SYSTEM ! # ############################################### wikidb="daniel_wiki" # the database your wiki stores data in #mysqlopt="-u username -ppassword" # any options used for interacting with mysql mysqlopt="" # usually empty if username and password are provided in your .my.cnf wikidir=~/www/mw # the directory mediawiki is installed in backupdir=~/bak # the directory to write the backup to ################## # END OF OPTIONS # ################## timestamp=`date +%Y-%m-%d` dbdump="$backupdir/wiki-$timestamp.sql.gz" xmldump="$backupdir/wiki-$timestamp.xml.gz" filedump="$backupdir/wiki-$timestamp.files.tgz" echo "Wiki backup. Database: $wikidb; Directory: $wikidir; Backup to: $backupdir" echo echo "creating database dump $dbdump..." mysqldump --default-character-set=latin1 $mysqlopt "$wikidb" | gzip > "$dbdump" || exit $? echo echo "creating XML dump $xmldump..." cd "$wikidir/maintenance" php -d error_reporting=E_ERROR dumpBackup.php --full | gzip > "$xmldump" || exit $? echo echo "creating file archive $filedump..." cd "$wikidir" tar --exclude .svn -zcf "$filedump" . || exit $? echo echo "Done!" echo "Files to copy to a safe place: $dbdump, $xmldump, $filedump" ####### # END # #######
It's also in the repository: code or pretty
[talk page]Talk:MediaWiki backup
The above comments may have been left by visitors.
This site's operators can not take responsibility for the content of such comments.




+z$8frZdyL%68pSU/:>w<:E3.lG-!XIB
Contents
[edit] generic modification suggestions
right after the options part I added:
Potential issues:
Modifcations worked for my on mediawiki 1.5 and 1.7 Use modifications at your own risk
[edit] Question
What name do we give to the file? backup.php? backup.sh?
[edit] Question
Thanks. ^_^
[edit] Options
What do we change here?
[edit] Question
And how to restore? Is there also a script available?
[edit] Restore ?
Where is the possible restore script ? Easy for the tar, but for sql and xml less straightforward... Tnx.
[edit] little correction of the generic modification suggestions
Bummer! this line doesn't work when there's a "=" in the password:
wikiDBpassword=`grep '^\$wgDB' $wikidir/LocalSettings.php |grep "DBpassword" | cut --delimiter="=" -f2 | cut --delimiter="\"" -f2`
I suggest this, assuming double quotes around the password (and none within):
wikiDBpassword=`grep '^\$wgDB' $wikidir/LocalSettings.php |grep "DBpassword" | cut --delimiter="\"" -f2 | cut --delimiter="\"" -f1`
[edit] Using PHP
# DATABASE SETTINGS DBUSER=`php -r 'define('MEDIAWIKI','true'); require("'${WIKIROOT}'/LocalSettings.php") ; echo $wgDBuser;'` DBPASSWORD=`php -r 'define('MEDIAWIKI','true'); require("'${WIKIROOT}'/LocalSettings.php") ; echo $wgDBpassword;'` DBNAME=`php -r 'define('MEDIAWIKI','true'); require("'${WIKIROOT}'/LocalSettings.php") ; echo $wgDBname;'`[edit] Mac DB Problem
Was this script also tested under Mac OS X?
I got the following error when creating the database dump:
wikibackup.sh: line 40: mysqldump: command not found
and the following when creating the XML dump:
DB connection error: Can't connect to local MySQL server through socket '/var/mysql/mysql.sock' (2) (localhost)
Using MAMP the socket should be here:
/Applications/MAMP/tmp/mysql/mysql.sock
Altough I don't know how to change that (if that has something to do with the problem at all)
[edit] Mac DB MySQL issue, first part...
Assuming a default installation of XAMPP, I suspect you need to add the following to your ~/.bash_profile:
This will allow the backup script to find mysqldump in the $PATH
(XAMPP for Mac OS X v0.7.3)
[edit] What Is the Best Way to Burn Fat
I recently saw this <http>//www.squidoo.com/burn-the-fat-feed-the-muscle-diet-book Burn the Fat book] . I've heard amazing reviews. Tom Venuto wrote the book and it's a proven dieting plan.