Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Exclude some dirs from site backups or backup GS only
#8
so.... If you want to get something - do it yourself Smile
here is my modifications to the file admin\zip.php. I remove directories controls (to obtain all files)

Code:
foreach($iter as $element) {
/* @var $element SplFileInfo */
$dir = str_replace($sourcePath, '', $element->getPath()) . '/';
//------------- zencoder 2012.05.27 - backup selected directories only -------------
//if (strstr($dir,$GSADMIN.DIRECTORY_SEPARATOR) || strstr($dir,'backups'.DIRECTORY_SEPARATOR)) {
//  #don't archive these folders
//} else if ($element->getFilename() != '..') { // FIX: if added to ignore parent directories
if ($element->getFilename() != '..') { // FIX: if added to ignore parent directories
// ------------- zencoder 2012.05.27 - backup selected directories only -------------
and add filter by file name mask just before command to pack file into backup.
Code:
// add file to archive
// ------------- zencoder 2012.05.27 - backup selected directories only -------------
// http://get-simple.info/wiki/how_to:backup_website?s[]=backup
if (
    strpos($file, 'data'.DIRECTORY_SEPARATOR ) == strlen(GSROOTPATH) ||
    strpos($file, 'admin'.DIRECTORY_SEPARATOR ) == strlen(GSROOTPATH) ||
    strpos($file, 'theme'.DIRECTORY_SEPARATOR ) == strlen(GSROOTPATH) ||
    strpos($file, 'plugins'.DIRECTORY_SEPARATOR ) == strlen(GSROOTPATH) ||
    // this is my folder outside GS which I want to be included into backup
    strpos($file, 'uploads'.DIRECTORY_SEPARATOR ) == strlen(GSROOTPATH)
   )  
// ------------- zencoder 2012.05.27 - backup selected directories only -------------
$archiv->addFile($file, $fileInArchiv);


My knowlege of PHP is slightly greater than zero, so code is ugly, but its work right as I need.
Can anybody write this more clearly?
It seems to me that directories (internal GS and users external like my uploads) included into backup must be defined like GSROOTPATH somewhere in gsconfig.php to be an universal solution.
Reply


Messages In This Thread
Exclude some dirs from site backups or backup GS only - by zencoder - 2012-05-27, 18:04:49



Users browsing this thread: 1 Guest(s)