Historique de Nico.BackupPmWiki
Cacher les modifications mineures - Affichage du code
but saves all directories mentionned at BackupAndRestore
but saves all directories mentioned at BackupAndRestore
It also fixes several bugs mentionned at BackupPages.
It also fixes several bugs mentioned at BackupPages.
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.
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, or back_pmwiki.php can be edited to use an action name different from backup
.
Anyone can download the backup archive file if they know or can guess its URL.
- Modified BackupPages script, adds ability to e-mail backup archive
[@set_time_limit(#of seconds); #for dev only!@\\
set_time_limit(#of seconds); #for dev only!
\\
Try
[@set_time_limit(#of seconds); #for dev only!@
in config php - I set mine very high for dev, pmwiki can crunch for 24 hours if I want. Seth
Try the new version (V1.1). It may fix your problem...
Try the new version (V1.1, updated with new version of zip package, fixing some bugs). It may solve your problem...
Try the new version. It may fix your problem...
Try the new version (V1.1). It may fix your problem...
Francis 04 septembre 2006 à 10h42
Try the new version. It may fix your problem...
Nicolas October 17, 2006
History
- V1.1 October 17, 2006 : integrated V2.1 of zip package from Devin Doucette. This may fix some bugs...
- V1.0 August 15, 2006 : first version.
- Actaully, with my problem this wasn't the case - I downloaded the file by ftp and it was a corrupted archive that couldn't be opened
- Actually, with my problem this wasn't the case - I downloaded the file by ftp and it was a corrupted archive that couldn't be opened
I have had trouble backing up our 'pub' directory which contains enough images to make the archive bigger than 50Mb. When it gets this big, the script crashes. So I have excluded the pub directory from the backup and it works fine for 20mb archives. Is this a bug, or something to do with my servers' setup? Francis 02 septembre 2006 à 05h19
I have had trouble backing up our 'pub' directory which contains enough images to make the archive bigger than 50Mb. When it gets this big, the script crashes. So I have excluded the pub directory from the backup and it works fine for 20mb archives. Is this a bug, or something to do with my servers' setup?
Francis 02 septembre 2006 à 05h19
I have had trouble backing up our 'pub' directory which contains enough images to make the archive bigger than 50Mb. When it gets this big, the script crashes. So I have excluded the pub directory from the backup and it works fine for 20mb archives. Is this a bug, or something to do with my servers' setup? Francis? 02 septembre 2006 à 05h19
I have had trouble backing up our 'pub' directory which contains enough images to make the archive bigger than 50Mb. When it gets this big, the script crashes. So I have excluded the pub directory from the backup and it works fine for 20mb archives. Is this a bug, or something to do with my servers' setup? Francis 02 septembre 2006 à 05h19
I successfully generated zip files larger than 130 Mo, but sometimes, for this kind of big archives, it seems that the HTML output between http server and client is "to slow" and may let think the script crashes. In fact, the zip is correctly generated (and can be obtained via FTP).
If anyone as an idea to prevent this "HTML output hanging", it would be helpful... Nicolas September 3, 2006
I have had trouble backing up our 'pub' directory which contains enough images to make the archive bigger than 50Mb. When it gets this big, the script crashes. So I have excluded the pub directory from the backup and it works fine for 20mb archives. Is this a bug, or something to do with my servers' setup? Francis? 02 septembre 2006 à 05h19
but saves all directories mentionned at BackupAndRestore,
but saves all directories mentionned at BackupAndRestore
The Attach:backup_pmwiki.txt script (rename it to php) adds an "?action=backup" which can be used to backup the wiki.d directory and subdirectory too. You can configure the directory where to place backups, set up the backup format and if you want, at the end of creation of backup file, show a link to download it.
The Attach:backup_pmwiki.txt script (rename it to php) adds an "?action=backup" which can be used to backup all the useful directories (and subdirectories). You can configure the directory where to place backups, set up the backup format and if you want, at the end of creation of backup file, show a link to download it.
Attach:backup_pmwiki.php.txt Δ
The Attach:backup_pmwiki.php Δ script adds an "?action=backup" which can be used to backup the wiki.d directory and subdirectory too. You can configure the directory where to place backups, set up the backup format and if you want, at the end of creation of backup file, show a link to download it.
The Attach:backup_pmwiki.txt script (rename it to php) adds an "?action=backup" which can be used to backup the wiki.d directory and subdirectory too. You can configure the directory where to place backups, set up the backup format and if you want, at the end of creation of backup file, show a link to download it.
/local/Admin.BackupWiki.php
/local/Admin.BackupWiki.php
//$BackupDir = '/mybackupdirectory/'; // defaults to '/backup/'
//$BackupDir = '/mybackupdirectory/'; // defaults to '/backup/'
<?php if (!defined('PmWiki')) exit(); //$BackupDir = '/mybackupdirectory/'; // defaults to '/backup/' // other parameters : see backup_pmwiki.php include_once('cookbook/backup_pmwiki.php'); ?>
<?php if (!defined('PmWiki')) exit();
//$BackupDir = '/mybackupdirectory/'; // defaults to '/backup/'
// other parameters : see backup_pmwiki.php
include_once('cookbook/backup_pmwiki.php');
?>
- BackupAndRestore
- BackupAndRestore
SteveAgl - Original script author
SteveAgl - original script author
Nicolas - backup all useful directories
Nicolas - fixed bugs, and added backup of all useful directories
visits
Contributor
Contributors
Nicolas August 15, 2006
SteveAgl - Original script author
Nicolas - backup all useful directories
(edit password = backup)
(edit password = backup)
Feel free to edit this page if you have any remarks...
Feel free to edit this page if you have any remarks... (edit password = backup)
The variable redefining the backup directory can be set before the script inclusion, as well as other parameter (see script).
The variable redefining the backup directory can be set before the script inclusion, as well as other parameters (see script).
The Attach:backup_pmwiki.php Δ script adds an "?action=backup" which can be used to backup the wiki.d directory and subdirectory too. You can configure the directory where to place backups, set up the backup format and if, at the end of creation of backup file, show a link to download it.
The Attach:backup_pmwiki.php Δ script adds an "?action=backup" which can be used to backup the wiki.d directory and subdirectory too. You can configure the directory where to place backups, set up the backup format and if you want, at the end of creation of backup file, show a link to download it.
The variable redefining the backup directory should be set before the script inclusion.
The variable redefining the backup directory can be set before the script inclusion, as well as other parameter (see script).
$RecentChangesFmt
= "";
$BackupDir = '/mybackupdirectory/';
include_once('cookbook/backup_pages.php');
include_once('cookbook/backup_pmwiki.php');
The script save only files which are in the /wiki.d/ directory. You should save the content of the /files/ directory apart.
- BackupPages (original script)
- BackupAndRestore
I'm not greatly in favor of adding admin functions directly to pmwiki, instead I created the script below to backup and restore the wiki.d directory. This uses the PEAR File::Archive package.
<HTML> <HEAD> <TITLE>Admin Functions</TITLE> <BODY> <H1>pmwiki Administration Functions</H1> <form method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>"> Backup Wiki <input type='radio' name='admin' value="backup"><br> Restore Wiki <input type='radio' name='admin' value='restore'><br> <input type=submit value="Submit"> <input type="hidden" name="_submit_check" value="1"/> </form> <?php ini_set("include_path", $_SERVER['DOCUMENT_ROOT'] . "/pear_includes/"); require_once "File/Archive.php"; if (array_key_exists('_submit_check', $_POST)) { if ($_POST['admin'] == 'backup') { echo "<b>archiving wiki.d</b>"; File_Archive::extract( File_Archive::read("wiki.d/"), File_Archive::toArchive("archive.tgz",File_Archive::toFiles()) ); } else { echo "<b>restoring wiki.d</b>"; File_Archive::extract( File_Archive::read("archive.tgz/"), File_Archive::toFiles("wiki.d/") ); } } ?> </BODY>
davidof? September 3, 2005 at 4:44pm
This doesn't work properly with wikifarms. Making a backup will save the zip file in the chosen directory. Making a backup from more than one farm at once will overwrite the precedent backup
kt007? March 13, 2005, at 10:34 AM~
I'll try to solve the problem in a next version with will allow to backup wiki.d or files directory or both, adding a password protection too. For Farm i have to set a simply local one to test it, but casue the libray used to zip files allow appending too it's just an option to add to the command line or in the internal option configuration. Thanks for the note.
SteveAgl? March 13, 2005, at 11:10 AM
This seems to always generate a zip file regardless of the extension specified. Looks like the code should switch on the format to determine the archive class to use instead of always using zip_file
. Also, the link generated for $ShowLink
was incorrect; I fixed it with the following:
If ($ShowLink) { $BackupUrl = preg_replace('#/[^/]*$#',"$BackupDir",$ScriptUrl,1); # use instead of $ScriptUrl.$BackupDir echo "<br /><br />You can download the backup file now: <a href='".$BackupUrl.$BackupFile.$BackupFormat."'>".$BackupUrl.$BackupFile.$BackupFormat."</a>"; }
KevinWatts? April 15, 2005, at 11:52 PM
It would be usefull if one could specify just a directory, i.e. the root directory of the wiki, and the scripts stuffs all subdirectories excluding the archive directory itself to make a complete snapshot of a wiki including the scripts, cookbook etc.
Schlaefer? April 17, 2005, at 05:51 AM
If your wiki's name has a space in it, your zip-file will have this space in its name, too. This max be a problem, because some FTP-clients (e.g. SmartFTP) won't do anything with such files (neither deleting nor renaming nor downloading). The solution is simple:
If ($DateFormat = 1 ) { SDV($BackupFile, str_replace(" ","",$WikiTitle)."_".date ("m-d-Y")); } else { SDV($BackupFile, str_replace(" ","",$WikiTitle)."_".date ("d-m-Y")); }
JustusvV? June 14, 2005, at 08:54 AM
The Farm issue could be fixed changing the next lines
# Set the local path to backup directory
//SDV($BackupDirPath,$FarmD
.$BackupDir);
SDV($BackupDirPath,$_SERVER[DOCUMENT_ROOT].$BackupDir); //for Farm
In my opinion this Cookbook receip should require the admin password The spaces are not the only issue in archive name '` could cause issues Isidor?
To protect this cookbook and only alow admin to backup the wiki, you can add these lines :
if (strpos($DefaultPasswords['admin'],$GLOBALS[authid])!==FALSE) { //Current Cookbook code here. }
Category: Administration
Category: Administration
The Attach: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 where to place backups, set up the backup format and if, 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 Backup? for a more complete list of files recommended for manual backups, and, eventually, an automated way to do it. -- Susan
The Attach:backup_pmwiki.php Δ script adds an "?action=backup" which can be used to backup the wiki.d directory and subdirectory too. You can configure the directory where to place backups, set up the backup format and if, at the end of creation of backup file, show a link to download it.
This script is inspired from BackupPages, but saves all directories mentionned at BackupAndRestore, (and not only wiki.d).
It also fixes several bugs mentionned at BackupPages.
Question
(:Description Is there an easy way to automatically backup '''all''' useful directories to a .zip file?:)Is there an easy way to automatically backup all useful directories to a .zip file?
Answer
The Attach: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 where to place backups, set up the backup format and if, 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 Backup? 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.
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.
See also
Discussion
I'm not greatly in favor of adding admin functions directly to pmwiki, instead I created the script below to backup and restore the wiki.d directory. This uses the PEAR File::Archive package.
<HTML> <HEAD> <TITLE>Admin Functions</TITLE> <BODY> <H1>pmwiki Administration Functions</H1> <form method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>"> Backup Wiki <input type='radio' name='admin' value="backup"><br> Restore Wiki <input type='radio' name='admin' value='restore'><br> <input type=submit value="Submit"> <input type="hidden" name="_submit_check" value="1"/> </form> <?php ini_set("include_path", $_SERVER['DOCUMENT_ROOT'] . "/pear_includes/"); require_once "File/Archive.php"; if (array_key_exists('_submit_check', $_POST)) { if ($_POST['admin'] == 'backup') { echo "<b>archiving wiki.d</b>"; File_Archive::extract( File_Archive::read("wiki.d/"), File_Archive::toArchive("archive.tgz",File_Archive::toFiles()) ); } else { echo "<b>restoring wiki.d</b>"; File_Archive::extract( File_Archive::read("archive.tgz/"), File_Archive::toFiles("wiki.d/") ); } } ?> </BODY>
davidof? September 3, 2005 at 4:44pm
This doesn't work properly with wikifarms. Making a backup will save the zip file in the chosen directory. Making a backup from more than one farm at once will overwrite the precedent backup
kt007? March 13, 2005, at 10:34 AM~
I'll try to solve the problem in a next version with will allow to backup wiki.d or files directory or both, adding a password protection too. For Farm i have to set a simply local one to test it, but casue the libray used to zip files allow appending too it's just an option to add to the command line or in the internal option configuration. Thanks for the note.
SteveAgl? March 13, 2005, at 11:10 AM
This seems to always generate a zip file regardless of the extension specified. Looks like the code should switch on the format to determine the archive class to use instead of always using zip_file
. Also, the link generated for $ShowLink
was incorrect; I fixed it with the following:
If ($ShowLink) { $BackupUrl = preg_replace('#/[^/]*$#',"$BackupDir",$ScriptUrl,1); # use instead of $ScriptUrl.$BackupDir echo "<br /><br />You can download the backup file now: <a href='".$BackupUrl.$BackupFile.$BackupFormat."'>".$BackupUrl.$BackupFile.$BackupFormat."</a>"; }
KevinWatts? April 15, 2005, at 11:52 PM
It would be usefull if one could specify just a directory, i.e. the root directory of the wiki, and the scripts stuffs all subdirectories excluding the archive directory itself to make a complete snapshot of a wiki including the scripts, cookbook etc.
Schlaefer? April 17, 2005, at 05:51 AM
If your wiki's name has a space in it, your zip-file will have this space in its name, too. This max be a problem, because some FTP-clients (e.g. SmartFTP) won't do anything with such files (neither deleting nor renaming nor downloading). The solution is simple:
If ($DateFormat = 1 ) { SDV($BackupFile, str_replace(" ","",$WikiTitle)."_".date ("m-d-Y")); } else { SDV($BackupFile, str_replace(" ","",$WikiTitle)."_".date ("d-m-Y")); }
JustusvV? June 14, 2005, at 08:54 AM
The Farm issue could be fixed changing the next lines
# Set the local path to backup directory
//SDV($BackupDirPath,$FarmD
.$BackupDir);
SDV($BackupDirPath,$_SERVER[DOCUMENT_ROOT].$BackupDir); //for Farm
In my opinion this Cookbook receip should require the admin password The spaces are not the only issue in archive name '` could cause issues Isidor?
To protect this cookbook and only alow admin to backup the wiki, you can add these lines :
if (strpos($DefaultPasswords['admin'],$GLOBALS[authid])!==FALSE) { //Current Cookbook code here. }
Contributor
SteveAgl? - Original script author
Nicolas - backup all useful directories
Category: Administration