BackupPages

Summary: Automatically back up the wiki.d directory to a .zip file
Version:
Prerequisites:
Status:
Maintainer:
Discussion: BackupPages-Talk
Categories: Administration

Questions answered by this recipe

Question

Is there an easy way to automatically back up the wiki.d directory to a .zip file?

Answer

The backup_pages.phpΔ script adds an "?action=backup" which can be used to backup the wiki.d directory and subdirectory too. You can configure the directory to save backups, the backup format and, at the end of creation of backup file, show a link to download it.

The wiki.d directory only contains the text of the contents, which in many cases is not enough. See BackupAndRestore for a more complete list of files recommended for manual backups, and, eventually, an automated way to do it. -- Susan

Backup directory might be created by hand and given 777 rights.

The variable redefining the backup directory should be set before the script inclusion.

It is better that this script is set only for a dedicated page, and so, the include set in a file associated to this page like

 /local/Admin.BackupWiki.php

This file may content something like :

 
<?php if (!defined('PmWiki')) exit();

$RecentChangesFmt = "";
$BackupDir = '/mybackupdirectory/';
include_once('cookbook/backup_pages.php');
?> 

Restrictions

The script save only files which are in the /wiki.d/ directory. You should save the content of the /files/ directory apart.

There is an alternative version which backs up all directories with custom content

This backup page can be read protected though ?action=backup is still possible on a read protected page. A cryptic name for the page and directory can help protection.

  • I tried adding $HandleAuth['backup'] ='attr'; To both config.php and my Site.Backup.php customisation, but it had no effect. Pwiki 2.2.0 beta33 Any Ideas why this shouldn't work? Francis

See also

Cookbook /
BackupHTMLZip  Export your wiki to static HTML then optionally compress/zip it (Experimental)
RestorePmWiki  Restore or move a PmWiki installation from an archive
SiteDump  creates a .tar.gz file of the complete site for download (stable)

Error

Substitute

 If ($DateFormat = 1 ) {

in the script with:

 If ($DateFormat == 1 ) {

This will solve the Date-Bug, that you are just able to use the american time format.

Contributor

SteveAgl - Script author

PRZ - Standard Cookbook format and addition info on how to use the recipe

Comments

See discussion at BackupPages-Talk