PMC-565
This commit is contained in:
@@ -103,26 +103,6 @@ EOT
|
||||
CLI::taskArg('workspace', true, true);
|
||||
CLI::taskRun("run_plugins_database_upgrade");
|
||||
|
||||
CLI::taskName('workspace-upgrade');
|
||||
CLI::taskDescription(<<<EOT
|
||||
Upgrade the specified workspace(s).
|
||||
|
||||
If no workspace is specified, the command will be run in all workspaces. More
|
||||
than one workspace can be specified.
|
||||
|
||||
This command is a shortcut to execute all the upgrade commands for workspaces.
|
||||
Upgrading a workspace will make it correspond to the current version of
|
||||
ProcessMaker.
|
||||
|
||||
Use this command to upgrade workspaces individually, otherwise use the
|
||||
'processmaker upgrade' command to upgrade the entire system.
|
||||
EOT
|
||||
);
|
||||
CLI::taskArg('workspace-name', true, true);
|
||||
CLI::taskOpt('buildACV', 'If this option is enabled, the Cache View is built.', 'ACV', 'buildACV');
|
||||
CLI::taskOpt('noxml', 'If this option is enabled, the XML files translation is not built.', 'NoXml', 'no-xml');
|
||||
CLI::taskRun("run_workspace_upgrade");
|
||||
|
||||
CLI::taskName('translation-repair');
|
||||
CLI::taskDescription(<<<EOT
|
||||
Upgrade or repair translations for the specified workspace(s).
|
||||
@@ -384,69 +364,6 @@ function run_info($args, $opts)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if we need to execute the workspace-upgrade
|
||||
* If we apply the command for all workspaces, we will need to execute one by one by redefining the constants
|
||||
*
|
||||
* @param string $args, workspace name that we need to apply the database-upgrade
|
||||
* @param string $opts, additional arguments
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function run_workspace_upgrade($args, $opts)
|
||||
{
|
||||
//Read the additional parameters for this command
|
||||
$parameters = '';
|
||||
$parameters .= array_key_exists('buildACV', $opts) ? '--buildACV ' : '';
|
||||
$parameters .= array_key_exists('noxml', $opts) ? '--no-xml ' : '';
|
||||
$parameters .= array_key_exists("lang", $opts) ? 'lang=' . $opts['lang'] : 'lang=' . SYS_LANG;
|
||||
|
||||
//Check if the command is executed by a specific workspace
|
||||
if (count($args) === 1) {
|
||||
workspace_upgrade($args, $opts);
|
||||
} else {
|
||||
$workspaces = get_workspaces_from_args($args);
|
||||
foreach ($workspaces as $workspace) {
|
||||
passthru(PHP_BINARY . ' processmaker upgrade ' . $parameters . ' ' . $workspace->name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is executed only by one workspace, for the command workspace-upgrade
|
||||
*
|
||||
* @param array $args, workspace name for to apply the upgrade
|
||||
* @param array $opts, specify additional arguments for language, flag for buildACV, flag for noxml
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function workspace_upgrade($args, $opts) {
|
||||
$first = true;
|
||||
$workspaces = get_workspaces_from_args($args);
|
||||
$lang = array_key_exists("lang", $opts) ? $opts['lang'] : 'en';
|
||||
$buildCacheView = array_key_exists('buildACV', $opts);
|
||||
$flagUpdateXml = !array_key_exists('noxml', $opts);
|
||||
|
||||
$wsName = $workspaces[key($workspaces)]->name;
|
||||
Bootstrap::setConstantsRelatedWs($wsName);
|
||||
//Loop, read all the attributes related to the one workspace
|
||||
foreach ($workspaces as $workspace) {
|
||||
try {
|
||||
$workspace->upgrade(
|
||||
$buildCacheView,
|
||||
$workspace->name,
|
||||
false,
|
||||
$lang,
|
||||
['updateXml' => $flagUpdateXml, 'updateMafe' => $first]
|
||||
);
|
||||
$first = false;
|
||||
$flagUpdateXml = false;
|
||||
} catch (Exception $e) {
|
||||
G::outRes("Errors upgrading workspace " . CLI::info($workspace->name) . ": " . CLI::error($e->getMessage()) . "\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* We will upgrade the CONTENT table
|
||||
* If we apply the command for all workspaces, we will need to execute one by one by redefining the constants
|
||||
@@ -1181,7 +1098,7 @@ function migrate_content($args, $opts)
|
||||
foreach ($workspaces as $workspace) {
|
||||
print_r('Regenerating content in: ' . pakeColor::colorize($workspace->name, 'INFO') . "\n");
|
||||
CLI::logging("-> Regenerating content \n");
|
||||
$workspace->migrateContentRun($workspace->name, $lang);
|
||||
$workspace->migrateContentRun($lang);
|
||||
}
|
||||
$stop = microtime(true);
|
||||
CLI::logging("<*> Optimizing content data Process took " . ($stop - $start) . " seconds.\n");
|
||||
|
||||
Reference in New Issue
Block a user