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:
@@ -563,14 +563,21 @@ 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);
|
||||||
|
|||||||
@@ -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__, ''));
|
||||||
mkdir($tempDirectory);
|
$parentDirectory = PATH_DATA . "upgrade";
|
||||||
|
if (is_writable($parentDirectory)) {
|
||||||
|
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");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user