User:Darizotas/MediaWiki Backup Script for Windows

Backup in Windows
Following the example given by the script User:Flominator/Backup MW, I decided to write a new command line script (after doing it, it becomes in two scripts) in order to create backups in Windows, from now on it'll be named Wiki-WinBackup. Wiki-WinBackup creates backups from:
 * 1) Database. Where is located most of the critical information. It worths mentioning that MySQL 5.0.x is used as backend. Therefore, the script will use the MySQL Dump command line tool.
 * 2) Files. As you will see, the files to be included can be configured easily. By default:
 * 3) * LocalSettings.php.
 * 4) * AdminSettings.php.
 * 5) * images directory.
 * 6) * extensions directory.

On top of that, this script will create full XML backups as well.

Requirements
The following scripts require to have installed:
 * 7-zip in order to create a zip file to ease the maintenance of the backup files.
 * PHP in order to run Manual:DumpBackup.php.

Tested in Windows XP, Windows 2003 Server R2, Windows 2000 Advanced Server.

Architecture
The Wiki-Backup architecture is based on the following files:
 * A ] that contains the files and directories to be added in the zip file.
 * , which is responsible of:
 * Creating the MySQL Dump file and create a zip file containing the previous dump file and the given list of files/directorios included in the to add.
 * Deleting the obsolete backup files.
 * , which is responsible to create the XML Dump and invoke the.

Text file
The text file will contain the complete path to the files/directories to be added in the backup zip file. One file/directory per line, following the 7-zip file list format. For example, Where MediaWiki-Folder is your Mediawiki installation folder. Remember the path must be quoted whenever it contains spaces.

Helper script
As a result of executing this script (let's name it zip-backup), a numbered zip file is created. Therefore, zip-backup will perform the following tasks:
 * Create the MySQL dump file
 * Create the zip file with the given contents and the MySQL dump file
 * Delete the obsolete files. It is understood by an obsolete file the one which sequence number exceeds the maximum to keep.

Let's see how to use it: zip-backup output-prefix output-path list-files string-conn [max-allowed] Where, Example: zip-backup "MyBackup" "C:\My Backups\" "C:\Program Files\ListMyBackup.txt" "schema@user:password" 10 This will create C:\My Backups\MyBackup-1.zip file containing the files/directories given at C:\Program Files\ListMyBackup.txt. And only the last 10 created zip files will be kept. Now, let's see the source code. Just copy it in a text file and rename it to zip-backup.cmd.

Main script
The main script (let's name it wiki-backup) uses to create and maintain the backup files. This script is just responsible to create the XML Backup and invoke the previous script. Let's see how to use it: wiki-backup output-preffix output-path list-files string-conn [max-allowed] Obviously, the needed parameters are exactly the same than the ones for. Said that, let's see the code. As well as for the just copy the source code in a text file and rename it as wiki-backup.cmd. Warning:' Please, notice you must set the environment variable wikiroot'' to the real MediaWiki installation folder before executing it.

Automating the backups
Finally, it's very important to automate the execution of Wiki-WinBackup. This can be accomplished by creating a Windows scheduled task (Start Menu -> Control Panel -> Scheduled tasks).

Recovery
Not yet implemented.

If true then where is the value of this back process?