BUG 9443 In Centos 5.4 Is not possible to do the restore a backup file SOLVED

- In Centos 5.4 is not possible to restore a backup file of ProcessMaker. we are using the next command.
- Adjustment in the restore backup, in the erased the hidden files.
This commit is contained in:
Hector Cortez
2012-08-03 18:00:50 -04:00
parent 41959ffb1a
commit 4dfa80ce75
2 changed files with 22 additions and 9 deletions

View File

@@ -563,15 +563,22 @@ class G
} }
if (is_dir($dirName)) { if (is_dir($dirName)) {
foreach(glob($dirName . '/*') as $file) { foreach(glob($dirName . '/{,.}*', GLOB_BRACE) as $file) {
if ( $file == $dirName . '/.' || $file == $dirName . '/..') {
continue;
}
if(is_dir($file)) { if(is_dir($file)) {
G::rm_dir($file); G::rm_dir($file);
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
exec('DEL /F /S /Q %' . $dirName . '%', $res); $dirNameWin = str_replace('/','\\' ,$dirName);
else exec('DEL /F /S /Q ' . $dirNameWin . '', $res);
exec('RD /S /Q ' . $dirNameWin . '', $res);
} else {
@rmdir($file); @rmdir($file);
} }
}
else { else {
@unlink($file); @unlink($file);
} }

View File

@@ -968,10 +968,16 @@ class workspaceTools {
$backup = new Archive_Tar($filename); $backup = new Archive_Tar($filename);
//Get a temporary directory in the upgrade directory //Get a temporary directory in the upgrade directory
$tempDirectory = PATH_DATA . "upgrade/" . basename(tempnam(__FILE__, '')); $tempDirectory = PATH_DATA . "upgrade/" . basename(tempnam(__FILE__, ''));
$parentDirectory = PATH_DATA . "upgrade";
if (is_writable($parentDirectory)) {
mkdir($tempDirectory); mkdir($tempDirectory);
} else {
throw new Exception("Could not create directory:" . $parentDirectory);
}
//Extract all backup files, including database scripts and workspace files //Extract all backup files, including database scripts and workspace files
if (!$backup->extract($tempDirectory)) if (!$backup->extract($tempDirectory)) {
throw new Exception("Could not extract backup"); throw new Exception("Could not extract backup");
}
//Search for metafiles in the new standard (the old standard would contain //Search for metafiles in the new standard (the old standard would contain
//txt files). //txt files).
$metaFiles = glob($tempDirectory . "/*.meta"); $metaFiles = glob($tempDirectory . "/*.meta");
@@ -1015,9 +1021,9 @@ class workspaceTools {
else else
throw new Exception("Destination workspace already exist (use -o to overwrite)"); throw new Exception("Destination workspace already exist (use -o to overwrite)");
if (file_exists($workspace->path)) if (file_exists($workspace->path)) {
G::rm_dir($workspace->path); G::rm_dir($workspace->path);
}
foreach ($metadata->directories as $dir) { foreach ($metadata->directories as $dir) {
CLI::logging("+> Restoring directory '$dir'\n"); CLI::logging("+> Restoring directory '$dir'\n");