This commit is contained in:
Roly Rudy Gutierrez Pinto
2018-05-09 10:16:05 -04:00
parent 33244d2dad
commit 4e450fff28
2 changed files with 42 additions and 18 deletions

View File

@@ -71,8 +71,11 @@ class DBSession
* @return void * @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) { if ($objConnection != null) {
$this->Free(); $this->Free();
$this->dbc = $objConnection; $this->dbc = $objConnection;
@@ -95,8 +98,11 @@ class DBSession
* @return void * @return void
* *
*/ */
function UseDB ($strDBName = DB_NAME) function UseDB ($strDBName = null)
{ {
if (empty($strDBName)) {
$strDBName = config("connections.workflow.database");
}
$this->dbname = $strDBName; $this->dbname = $strDBName;
} }

View File

@@ -209,7 +209,7 @@ EOT
CLI::taskArg('workspace', true, true); CLI::taskArg('workspace', true, true);
CLI::taskRun("run_migrate_itee_to_dummytask"); CLI::taskRun("run_migrate_itee_to_dummytask");
/* ----------------------------------********--------------------------------- */ /*----------------------------------********---------------------------------*/
CLI::taskName("check-workspace-disabled-code"); CLI::taskName("check-workspace-disabled-code");
CLI::taskDescription(<<<EOT CLI::taskDescription(<<<EOT
Check disabled code for the specified workspace(s). Check disabled code for the specified workspace(s).
@@ -248,7 +248,7 @@ EOT
); );
CLI::taskArg('workspace', true, true); CLI::taskArg('workspace', true, true);
CLI::taskRun("run_migrate_list_unassigned"); CLI::taskRun("run_migrate_list_unassigned");
/* ----------------------------------********--------------------------------- */ /*----------------------------------********---------------------------------*/
CLI::taskName('migrate-indexing-acv'); CLI::taskName('migrate-indexing-acv');
CLI::taskDescription(<<<EOT CLI::taskDescription(<<<EOT
@@ -344,15 +344,23 @@ CLI::taskRun("regenerate_pmtable_classes");
/** /**
* Function run_info * Function run_info
* access public *
* @param array $args
* @param array $opts
*/ */
function run_info($args, $opts) function run_info($args, $opts)
{ {
$workspaces = get_workspaces_from_args($args);
WorkspaceTools::printSysInfo(); WorkspaceTools::printSysInfo();
//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) { foreach ($workspaces as $workspace) {
echo "\n"; echo "\n";
$workspace->printMetadata(false); 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) function runStructureDirectories($command, $args)
{ {
$workspaces = get_workspaces_from_args($command); $workspaces = get_workspaces_from_args($command);
$count = count($workspaces); if (count($command) === 1) {
$errors = false;
$countWorkspace = 0;
foreach ($workspaces as $index => $workspace) {
try { try {
$countWorkspace++; $workspace = $workspaces[0];
CLI::logging("Updating workspaces ($countWorkspace/$count): " . CLI::info($workspace->name) . "\n"); CLI::logging(": " . CLI::info($workspace->name) . "\n");
$workspace->updateStructureDirectories($workspace->name); $workspace->updateStructureDirectories($workspace->name);
$workspace->close(); $workspace->close();
} catch (Exception $e) { } catch (Exception $e) {
CLI::logging("Errors upgrading workspace " . CLI::info($workspace->name) . ": " . CLI::error($e->getMessage()) . "\n"); 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 * 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 * Check if we need to execute an external program for each workspace