[MediaWiki-l] backup wiki

Nicolas Brouard brouard at ined.fr
Wed Mar 27 18:44:31 UTC 2013


Hi,

No, there is no easy solution. Images are stored in an other directory and have nothing to do with your mediawiki versioned php files. Also, extensions are (more or less dependent of the mediawiki version used) located in a different tree.

Thus you should have a new extension folder and copy your images tree in a new folder too. Databases have to be backup independently with mysqldump for examples.

In order to update an old mediawiki version, you could look at the last paragraph named "Wikimedia method" (http://www.mediawiki.org/wiki/Manual:Wiki_family#Wikimedia_Method). It has also been the simplest method for me even if I am not sure that this is the method used by Wikimedia anymore.

Below is is the sentence with the "key" idea which consists in using the various php scripts of the 'maintenance' directory by including them in a outer script which redefines SERVER values as well as $wgDBname values etc., which are 'inherited' by maintenance/update.php or other scripts. I spent some time before understanding this point:

------------------------  
The script maintenance/update.php can be included from a another php script, update_farm.php for example, and this outer script will set the various SERVER values that are needed by your LocalSettings.php to set the correct $wgDBname:

<?php
# update_farm.php script
$_SERVER['SERVER_NAME'] = $argv[1];
$_SERVER['DOCUMENT_ROOT']=  $argv[2]; #optional
include("maintenance/update.php")
and the command line for updating meta.yourdomain.net is, from your unique mediawiki directory:

php update_farm.php meta.yourdomain.net
Your unique LocalSettings.php (which usually consists in a few lines including a CommonSettings.php not directly accessible from the server) decodes the variable meta and will set the $wgDBname accordingly.


----------------------------
Looking at my current backup procedures, I have a bash script with 3 arguments
dumpBackupXML-somelanguages.sh :
-----
domain=$1 # domain 
optiondump=$2 # current or full
listlanguages=$3
if [ $# -ne 3 ]
# Standard check whether command line arg is present.
then
  echo Usage: ./`basename $0` "domain="$domain $optiondump $listlanguages
  exit 1
fi
DATENOW=$(date +"%F-%H-%M")
...
Settings from the listlanguages: the server name '-server' and the correct  directory where the 
unique LocalSettings.php file resides, $dirdep, wgDBprefix, wgDBname
...
 php ./dumpxml_subdomains.php  --server ${lang}${dashedition}.${domain}  --conf ${conf}LocalSettings.php --docroot ${conf} ${optiondump} --output=bzip2:$dirdep/${wgDBprefix}-${domain}${optiondump}-${DATENOW}.xml.bz2
----
and the dumpxml_subdomains.php is similar to:
------------
<?php
$server = $argv[2]; //$argv gets commandline arguments
$conf = $argv[4];
$docroot= $argv[6];
$optiondump = $argv[8];

if ($argc <>9) {
  print "Runs dumpBackup.php by passing --server, --conf, --full or --current --output values. \n --docroot \ndumpBackup_subdomains.php --server $server --conf $conf --current --output=bzip2:file\n";
 exit;
}
// set domain name
$_SERVER['SERVER_NAME'] = $server;
$_SERVER['DOCUMENT_ROOT']=  $docroot;
echo '--------------------------------------
Running dumpBackup.php for ' . $server . ' on ' .$docroot.' with conf ' .$conf.' and  option '.$optiondump.'
--------------------------------------
';
include("${docroot}maintenance/dumpBackup.php");
echo '------------------------end--------------
---------



I hope not misunderstanding your questions.
Regards,


Nicolas
Le 27 mars 2013 à 17:16, Scheid, Bernhard a écrit :

> Hi, 
> 
> I would like to set up a backup version of a Wiki that allows to experiment with new features. Therefore, I would like to share basically all mediawiki directories, esp. images, with the original wiki, but use a different database, and a different extension folder. 
> 
> I have been looking at http://www.mediawiki.org/wiki/Manual:Wiki_family but the suggestions there sound terribly complicated. Isn't there an easy solution, with the backup wiki consisting just of a new LocalSettings.php, a new extensions folder and a new database?
> 
> Thx in advance
> 
> Bernhard
> _______________________________________________
> MediaWiki-l mailing list
> MediaWiki-l at lists.wikimedia.org
> https://lists.wikimedia.org/mailman/listinfo/mediawiki-l

--
N. Brouard





More information about the MediaWiki-l mailing list