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

@@ -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);
} }
} }
} }