HOR-3260 improvement

This commit is contained in:
Roly Rudy Gutierrez Pinto
2017-05-24 15:29:26 -04:00
parent 8a68563f83
commit 68b32a35f0
2 changed files with 43 additions and 29 deletions

View File

@@ -36,14 +36,45 @@ EOT
CLI::taskArg('workspace', true, true);
CLI::taskRun('run_flush_cache');
/**
* Flush the cache files for the specified workspace.
* If no workspace is specified, then the cache will be flushed in all available
* workspaces.
*
* @param array $args
* @param array $opts
*/
function run_flush_cache($args, $opts)
{
if (!defined("PATH_C")) {
die("ERROR: seems processmaker is not properly installed (System constants are missing)." . PHP_EOL);
}
$workspaces = get_workspaces_from_args($args);
if (count($args) === 1) {
\ProcessMaker\Util\System::flushCache($args, $opts);
flush_cache($workspaces[0]);
} else {
$workspaces = get_workspaces_from_args($args);
foreach ($workspaces as $workspace) {
passthru("./processmaker flush-cache " . $workspace->name);
}
}
}
/**
* Flush the cache files for the specified workspace.
*
* @param object $workspace
*/
function flush_cache($workspace)
{
try {
CLI::logging("Flush " . pakeColor::colorize("system", "INFO") . " cache ... ");
echo PHP_EOL;
echo " Update singleton in workspace " . $workspace->name . " ... ";
echo PHP_EOL;
echo " Flush workspace " . pakeColor::colorize($workspace->name, "INFO") . " cache ... " . PHP_EOL;
$status = \ProcessMaker\Util\System::flushCache($workspace);
echo "DONE" . PHP_EOL;
} catch (Exception $e) {
echo $e->getMessage() . PHP_EOL;
}
}