Merged in victorsl/processmaker/3.0.1-GA (pull request #2598)

PM-3037 "0017677: The 'processmaker workspace-restore' command..." SOLVED
This commit is contained in:
Julio Cesar Laura Avendaño
2015-08-12 09:34:02 -04:00
3 changed files with 154 additions and 80 deletions

View File

@@ -669,13 +669,10 @@ function run_check_workspace_disabled_code($args, $opts)
function migrate_new_cases_lists($command, $args) {
$workspaces = get_workspaces_from_args($args);
$checkOnly = (strcmp($command, "migrate") == 0);
foreach ($workspaces as $workspace) {
if ($checkOnly){
print_r("Checking database in ".pakeColor::colorize($workspace->name, "INFO")."\n");
} else {
print_r("Upgrading database in ".pakeColor::colorize($workspace->name, "INFO")."\n");
}
print_r("Upgrading database in " . pakeColor::colorize($workspace->name, "INFO") . "\n");
try {
$ws = $workspace->name;
$sContent = file_get_contents (PATH_DB . $ws . PATH_SEP . 'db.php');
@@ -684,21 +681,16 @@ function migrate_new_cases_lists($command, $args) {
} else {
$workspace->onedb = true;
}
//check if is the tables List are empty
$changes = $workspace->listFirstExecution('check');
if ($workspace->onedb && $changes != true) {
$workspace->migrateList($workspace->name);
}
if ($changes) {
if ($checkOnly) {
echo "-> List tables are done\n";
if ($workspace->onedb) {
$workspace->migrateList($workspace->name, true);
}
} else {
echo "> List tables are done\n";
}
} catch (Exception $e) {
echo "> Error: ".CLI::error($e->getMessage()) . "\n";
}
}
}
/*----------------------------------********---------------------------------*/

File diff suppressed because it is too large Load Diff

View File

@@ -1417,7 +1417,7 @@ class AppCacheView extends BaseAppCacheView
}
if (!$found) {
$filenameSql = $this->pathToAppCacheFiles . '/triggerAppDelegationUpdate.sql';
$filenameSql = $this->pathToAppCacheFiles . "triggerAppDelegationUpdate.sql";
if (!file_exists($filenameSql)) {
throw (new Exception("file triggerAppDelegationUpdate.sql does not exist "));
@@ -1462,7 +1462,7 @@ class AppCacheView extends BaseAppCacheView
}
if (!$found) {
$filenameSql = $this->pathToAppCacheFiles . '/triggerApplicationUpdate.sql';
$filenameSql = $this->pathToAppCacheFiles . "triggerApplicationUpdate.sql";
if (!file_exists($filenameSql)) {
throw (new Exception("file triggerApplicationUpdate.sql doesn't exist "));
@@ -1507,7 +1507,7 @@ class AppCacheView extends BaseAppCacheView
}
if (!$found) {
$filenameSql = $this->pathToAppCacheFiles . '/triggerApplicationDelete.sql';
$filenameSql = $this->pathToAppCacheFiles . "triggerApplicationDelete.sql";
if (!file_exists($filenameSql)) {
throw (new Exception("file triggerApplicationDelete.sql doesn't exist"));
@@ -1545,7 +1545,7 @@ class AppCacheView extends BaseAppCacheView
}
if (!$found) {
$filenameSql = $this->pathToAppCacheFiles . PATH_SEP . "triggerContentUpdate.sql";
$filenameSql = $this->pathToAppCacheFiles . "triggerContentUpdate.sql";
if (!file_exists($filenameSql)) {
throw (new Exception("file triggerContentUpdate.sql doesn't exist"));
@@ -1621,7 +1621,7 @@ class AppCacheView extends BaseAppCacheView
$triggers = array();
foreach ($triggerFiles as $triggerFile) {
$trigger = file_get_contents("{$this->pathToAppCacheFiles}/$triggerFile");
$trigger = file_get_contents($this->pathToAppCacheFiles . $triggerFile);
if ($trigger === false) {
throw new Exception("Could not read trigger contents in $triggerFile");