diff --git a/gulliver/system/class.dbsession.php b/gulliver/system/class.dbsession.php index 34d1ef1e8..f987d45a4 100644 --- a/gulliver/system/class.dbsession.php +++ b/gulliver/system/class.dbsession.php @@ -71,8 +71,11 @@ class DBSession * @return void * */ - function setTo ($objConnection = null, $strDBName = DB_NAME) + function setTo ($objConnection = null, $strDBName = null) { + if (empty($strDBName)) { + $strDBName = config("connections.workflow.database"); + } if ($objConnection != null) { $this->Free(); $this->dbc = $objConnection; @@ -95,8 +98,11 @@ class DBSession * @return void * */ - function UseDB ($strDBName = DB_NAME) + function UseDB ($strDBName = null) { + if (empty($strDBName)) { + $strDBName = config("connections.workflow.database"); + } $this->dbname = $strDBName; } diff --git a/workflow/engine/bin/tasks/cliWorkspaces.php b/workflow/engine/bin/tasks/cliWorkspaces.php index e78de67d3..ff2010595 100644 --- a/workflow/engine/bin/tasks/cliWorkspaces.php +++ b/workflow/engine/bin/tasks/cliWorkspaces.php @@ -209,7 +209,7 @@ EOT CLI::taskArg('workspace', true, true); CLI::taskRun("run_migrate_itee_to_dummytask"); -/* ----------------------------------********--------------------------------- */ +/*----------------------------------********---------------------------------*/ CLI::taskName("check-workspace-disabled-code"); CLI::taskDescription(<<printMetadata(false); + + //Check if the command is executed by a specific workspace + $workspaces = get_workspaces_from_args($args); + if (count($args) === 1) { + $workspaces[0]->printMetadata(false); + } else { + foreach ($workspaces as $workspace) { + echo "\n"; + passthru(PHP_BINARY . " processmaker info " . $workspace->name); + } } } @@ -865,21 +873,31 @@ function run_workspace_restore($args, $opts) } } +/** + * Migrating cases folders of the workspaces + * + * @param array $command + * @param array $args + */ function runStructureDirectories($command, $args) { $workspaces = get_workspaces_from_args($command); - $count = count($workspaces); - $errors = false; - $countWorkspace = 0; - foreach ($workspaces as $index => $workspace) { + if (count($command) === 1) { try { - $countWorkspace++; - CLI::logging("Updating workspaces ($countWorkspace/$count): " . CLI::info($workspace->name) . "\n"); + $workspace = $workspaces[0]; + CLI::logging(": " . CLI::info($workspace->name) . "\n"); $workspace->updateStructureDirectories($workspace->name); $workspace->close(); } catch (Exception $e) { CLI::logging("Errors upgrading workspace " . CLI::info($workspace->name) . ": " . CLI::error($e->getMessage()) . "\n"); - $errors = true; + } + } else { + $count = count($workspaces); + $countWorkspace = 0; + foreach ($workspaces as $index => $workspace) { + $countWorkspace++; + CLI::logging("Updating workspaces ($countWorkspace/$count)"); + passthru(PHP_BINARY . " processmaker migrate-cases-folders " . $workspace->name); } } } @@ -981,7 +999,7 @@ function run_migrate_itee_to_dummytask($args, $opts) } } } -/* ----------------------------------********--------------------------------- */ +/*----------------------------------********---------------------------------*/ /** * Check if we need to execute an external program for each workspace @@ -1118,7 +1136,7 @@ function migrate_list_unassigned($command, $args, $opts) } } } -/* ----------------------------------********--------------------------------- */ +/*----------------------------------********---------------------------------*/ /** * Check if we need to execute an external program for each workspace