PMCORE-2302 Add in the upgrade process a script to update the table SCHEDULER in order to add the new option +async

This commit is contained in:
Roly Rudy Gutierrez Pinto
2020-10-09 18:19:35 -04:00
committed by Julio Cesar Laura Avendaño
parent c434e13467
commit 56b2a4f6dd
3 changed files with 129 additions and 0 deletions

View File

@@ -428,6 +428,17 @@ EOT
CLI::taskArg('fontFileName', false);
CLI::taskRun('documents_remove_font');
/**
* Add +async option to scheduler commands in table SCHEDULER.
*/
CLI::taskName('add-async-option-to-scheduler-commands');
CLI::taskDescription(<<<EOT
Add +async option to scheduler commands in table SCHEDULER.
EOT
);
CLI::taskArg('workspace');
CLI::taskRun('add_async_option_to_scheduler_commands');
/**
* Function run_info
*
@@ -1606,3 +1617,26 @@ function documents_remove_font($args)
CLI::logging($e->getMessage() . PHP_EOL . PHP_EOL);
}
}
/**
* Add +async option to scheduler commands in table SCHEDULER.
* @param array $args
* @param string $opts
*/
function add_async_option_to_scheduler_commands($args, $opts)
{
if (count($args) === 1) {
Bootstrap::setConstantsRelatedWs($args[0]);
$workspaceTools = new WorkspaceTools($args[0]);
CLI::logging("> Adding +async option to scheduler commands...\n");
$start = microtime(true);
$workspaceTools->addAsyncOptionToSchedulerCommands(true);
CLI::logging("<*> Adding +async option to scheduler commands took " . (microtime(true) - $start) . " seconds.\n");
} else {
$workspaces = get_workspaces_from_args($args);
foreach ($workspaces as $workspace) {
passthru(PHP_BINARY . ' processmaker add-async-option-to-scheduler-commands ' . $workspace->name);
}
}
}