HOR-3260 improvement
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user