Merged in bugfix/HOR-4817 (pull request #6610)

HOR-4817

Approved-by: Paula Quispe <paula.quispe@processmaker.com>
Approved-by: Julio Cesar Laura Avendaño <contact@julio-laura.com>
This commit is contained in:
Roly
2018-10-16 19:50:37 +00:00
committed by Julio Cesar Laura Avendaño
2 changed files with 143 additions and 0 deletions

View File

@@ -233,6 +233,12 @@ class WorkspaceTools
$arrayOptTranslation = ['updateXml' => true, 'updateMafe' => true];
}
$start = microtime(true);
CLI::logging("> Remove deprecated files...\n");
$this->removeDeprecatedFiles();
$stop = microtime(true);
CLI::logging("<*> Remove deprecated files took " . ($stop - $start) . " seconds.\n");
$start = microtime(true);
CLI::logging("> Updating database...\n");
$this->upgradeDatabase($onedb);
@@ -2000,6 +2006,12 @@ class WorkspaceTools
}
}
$start = microtime(true);
CLI::logging("> Remove deprecated files...\n");
$workspace->removeDeprecatedFiles();
$stop = microtime(true);
CLI::logging("<*> Remove deprecated files took " . ($stop - $start) . " seconds.\n");
if (($pmVersionWorkspaceToRestore != '') && (version_compare(
$pmVersionWorkspaceToRestore . "",
$pmVersion . "",
@@ -4560,4 +4572,28 @@ class WorkspaceTools
. "WHERE ASSIGNEE_ID = 0");
$con->commit();
}
/**
* Remove deprecated files and directory.
*/
public function removeDeprecatedFiles()
{
$deprecatedFiles = PATH_TRUNK . PATH_SEP . 'config' . PATH_SEP . 'deprecatedFiles.lst';
if (file_exists($deprecatedFiles)) {
$handle = fopen($deprecatedFiles, 'r');
if ($handle) {
while (($line = fgets($handle)) !== false) {
$line = trim($line, "\n");
CLI::logging("> Remove file/folder " . $line . " ");
if (file_exists($line)) {
G::rm_dir($line);
CLI::logging("[OK]\n");
} else {
CLI::logging("[Already removed]\n");
}
}
fclose($handle);
}
}
}
}