Wiki recommendations -- Practical Experience

Luis Paulo luis.barbas at gmail.com
Thu May 6 17:05:53 UTC 2010


On Thu, May 6, 2010 at 5:32 PM, Patton Echols <p.echols at comcast.net> wrote:
> [..]
>
> A question about MediaWiki if you don't mind.  For testing purposes, I'm
> not concerned about backups.  But obviously that is a concern before
> production work gets done the wiki. I am not familiar with mySql
> backups.  Is that difficult or a concern?  (MoinMoin is not database
> driven so you just back up the directory, like anything else.)
>
> [..]
>
> --PE

The way I backup mediawiki content is to backup the mysql database

I have the following on my wiki about mediawiki maintenance
----------------------------------------------------------------------------------------------------------------------
== Maintenance ==
[http://www.mediawiki.org/wiki/Manual:Maintenance_scripts
http://www.mediawiki.org/wiki/Manual:Maintenance_scripts]

===Backup Script===
Create BACKUP_DIR if needed. Run as root

 #!/bin/bash
 DATABASE_NAME='mwiki'
 USERNAME='root'
 PASSWORD='*******'
 BACKUP_DIR='/usr/share/mediawiki/backup'
 FNAME=`date +%y-%m-%d`

 cd /usr/share/mediawiki
 mysqldump --database $DATABASE_NAME -u $USERNAME -p$PASSWORD
--add-drop-table -B > ${FNAME}.sql
 zip -r $BACKUP_DIR/${FNAME}.zip images/ ${FNAME}.sql
LocalSettings.php extensions/ -x  backup/
 rm ${FNAME}.sql

 cd $BACKUP_DIR
 #Count files in directory (hidden files (filename starts with a dot)
are ignored)
 file_count=`ls | wc -l`

 #Do until there are more than or equal 6 files present
 while [ $file_count -ge 6 ]
 do
        #you can save deleted filenames in variable (e.g. for deleting
files also in backup directory)
        #not recommended for filenames with space(s)
        del_files="${del_files} `ls | head -n 1`"
        #Delete alphabetically oldest file (ls sort by name is default)
        rm `ls | head -n 1`
        #Count files again
        file_count=`ls | wc -l`
 done

== Character set and latin1 to utf8 conversion ==
http://www.mediawiki.org/wiki/Manual:Backing_up_a_wiki#Character_set
----------------------------------------------------------------------------------------------------------------------

I put the backup script (as you may see, it uses  mysqldump) in a cron job.
There's also a mysql graphical management and backup/restore utility,
mysql-admin package, that you should look to.
And, why not, maybe mysql-query-browser too.

The thing I don't like is that if you want to restore the backup to
use with a different mediawiki version you'll have to be sure that the
database structure hadn't change.
Last time I needed (changing the wiki to a new computer) I didn't
found info about that. I didn't had any problems, so I assume it was
the same between those mediawiki versions. :)

mediawiki also have a dump utility that you may look for.

regards
Luis




More information about the ubuntu-users mailing list