public static function archive($name = false, $listFilesAndFolders, $export_files_dir, $export_files_dir_name, $backupName, $move = false, $identifier, $type)
{
if (empty($export_files_dir)) {
return;
}
$dir_separator = DIRECTORY_SEPARATOR;
$backupName = 'backup' . $dir_separator . $backupName;
$installFilePath = 'system' . $dir_separator . 'admin-scripts' . $dir_separator . 'miscellaneous' . $dir_separator;
$dbSQLFilePath = 'backup' . $dir_separator;
$old_path = getcwd();
chdir($export_files_dir);
$tar = new Archive_Tar($backupName, 'gz');
if (SJB_System::getIfTrialModeIsOn()) {
$tar->setIgnoreList(array('system/plugins/mobile', 'system/plugins/facebook_app', 'templates/mobile', 'templates/Facebook'));
}
SessionStorage::write('backup_' . $identifier, serialize(array('last_time' => time())));
switch ($type) {
case 'full':
$tar->addModify("{$installFilePath}install.php", '', $installFilePath);
$tar->addModify($dbSQLFilePath . $name, '', $dbSQLFilePath);
$tar->addModify($listFilesAndFolders, '');
SJB_Filesystem::delete($export_files_dir . $dbSQLFilePath . $name);
break;
case 'files':
$tar->addModify("{$installFilePath}install.php", '', $installFilePath);
$tar->addModify($listFilesAndFolders, '');
break;
case 'database':
$tar->addModify($dbSQLFilePath . $listFilesAndFolders, '', $dbSQLFilePath);
SJB_Filesystem::delete($export_files_dir . $dbSQLFilePath . $listFilesAndFolders);
break;
}
chdir($old_path);
return true;
}