Merged in bugfix/HOR-3568-A (pull request #5840)
HOR-3568 Approved-by: Julio Cesar Laura Avendaño <contact@julio-laura.com>
This commit is contained in:
@@ -162,6 +162,8 @@ CLI::taskDescription(<<<EOT
|
|||||||
EOT
|
EOT
|
||||||
);
|
);
|
||||||
CLI::taskArg('workspace-name', true, true);
|
CLI::taskArg('workspace-name', true, true);
|
||||||
|
CLI::taskOpt('noxml', 'If this option is enabled, the XML files will not be modified.', 'NoXml', 'no-xml');
|
||||||
|
CLI::taskOpt('nomafe', 'If this option is enabled, the Front End (BPMN Designer and Bootstrap Forms) translation file will not be modified.', 'NoMafe', 'no-mafe');
|
||||||
CLI::taskRun("run_translation_upgrade");
|
CLI::taskRun("run_translation_upgrade");
|
||||||
|
|
||||||
CLI::taskName('migrate-cases-folders');
|
CLI::taskName('migrate-cases-folders');
|
||||||
@@ -370,22 +372,62 @@ function run_workspace_upgrade($args, $opts) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* We will repair the translation in the languages defined in the workspace
|
||||||
|
* Verify if we need to execute an external program for each workspace
|
||||||
|
* If we apply the command for all workspaces, we will need to execute one by one by redefining the constants
|
||||||
|
* @param string $args, workspaceName that we need to apply the database-upgrade
|
||||||
|
* @param string $opts
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
function run_translation_upgrade($args, $opts) {
|
function run_translation_upgrade($args, $opts) {
|
||||||
G::LoadSystem('inputfilter');
|
$noXml = array_key_exists('noxml', $opts) ? '--no-xml' : '';
|
||||||
$filter = new InputFilter();
|
$noMafe = array_key_exists('nomafe', $opts) ? '--no-mafe' : '';
|
||||||
$opts = $filter->xssFilterHard($opts);
|
if (!empty($noXml)) {
|
||||||
$args = $filter->xssFilterHard($args);
|
$noMafe = ' ' . $noMafe;
|
||||||
$workspaces = get_workspaces_from_args($args);
|
}
|
||||||
$first = true;
|
//Check if the command is executed by a specific workspace
|
||||||
foreach ($workspaces as $workspace) {
|
if (count($args) === 1) {
|
||||||
try {
|
translation_upgrade($args, $opts);
|
||||||
G::outRes( "Upgrading translation for " . pakeColor::colorize($workspace->name, "INFO") . "\n" );
|
} else {
|
||||||
$workspace->upgradeTranslation($first, $first);
|
$workspaces = get_workspaces_from_args($args);
|
||||||
$first = false;
|
foreach ($workspaces as $workspace) {
|
||||||
} catch (Exception $e) {
|
passthru('./processmaker translation-repair ' . $noXml . $noMafe . ' ' . $workspace->name);
|
||||||
G::outRes( "Errors upgrading translation of workspace " . CLI::info($workspace->name) . ": " . CLI::error($e->getMessage()) . "\n" );
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function will regenerate the translation for a workspace
|
||||||
|
* This function is executed only for one workspace
|
||||||
|
* @param array $args, workspaceName that we will to apply the command
|
||||||
|
* @param array $opts, noxml and nomafe flags
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function translation_upgrade($args, $opts)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
//Load the attributes for the workspace
|
||||||
|
$arrayWorkspace = get_workspaces_from_args($args);
|
||||||
|
//Loop, read all the attributes related to the one workspace
|
||||||
|
$wsName = $arrayWorkspace[key($arrayWorkspace)]->name;
|
||||||
|
Bootstrap::setConstantsRelatedWs($wsName);
|
||||||
|
$workspaces = get_workspaces_from_args($args);
|
||||||
|
$flagUpdateXml = (!array_key_exists('noxml', $opts));
|
||||||
|
$flagUpdateMafe = (!array_key_exists('nomafe', $opts));
|
||||||
|
foreach ($workspaces as $workspace) {
|
||||||
|
try {
|
||||||
|
G::outRes("Upgrading translation for " . pakeColor::colorize($workspace->name, "INFO") . "\n");
|
||||||
|
$workspace->upgradeTranslation($flagUpdateXml, $flagUpdateMafe);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
G::outRes("Errors upgrading translation of workspace " . CLI::info($workspace->name) . ": " . CLI::error($e->getMessage()) . "\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception $e) {
|
||||||
|
G::outRes(CLI::error($e->getMessage()) . "\n");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function run_cacheview_upgrade($args, $opts) {
|
function run_cacheview_upgrade($args, $opts) {
|
||||||
|
|||||||
Reference in New Issue
Block a user