Merge branch 'feature/HOR-3610' of https://bitbucket.org/colosa/processmaker into feature/HOR-3610
This commit is contained in:
@@ -162,6 +162,8 @@ CLI::taskDescription(<<<EOT
|
||||
EOT
|
||||
);
|
||||
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::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) {
|
||||
|
||||
$filter = new InputFilter();
|
||||
$opts = $filter->xssFilterHard($opts);
|
||||
$args = $filter->xssFilterHard($args);
|
||||
$workspaces = get_workspaces_from_args($args);
|
||||
$first = true;
|
||||
foreach ($workspaces as $workspace) {
|
||||
try {
|
||||
G::outRes( "Upgrading translation for " . pakeColor::colorize($workspace->name, "INFO") . "\n" );
|
||||
$workspace->upgradeTranslation($first, $first);
|
||||
$first = false;
|
||||
} catch (Exception $e) {
|
||||
G::outRes( "Errors upgrading translation of workspace " . CLI::info($workspace->name) . ": " . CLI::error($e->getMessage()) . "\n" );
|
||||
$noXml = array_key_exists('noxml', $opts) ? '--no-xml' : '';
|
||||
$noMafe = array_key_exists('nomafe', $opts) ? '--no-mafe' : '';
|
||||
if (!empty($noXml)) {
|
||||
$noMafe = ' ' . $noMafe;
|
||||
}
|
||||
//Check if the command is executed by a specific workspace
|
||||
if (count($args) === 1) {
|
||||
translation_upgrade($args, $opts);
|
||||
} else {
|
||||
$workspaces = get_workspaces_from_args($args);
|
||||
foreach ($workspaces as $workspace) {
|
||||
passthru('./processmaker translation-repair ' . $noXml . $noMafe . ' ' . $workspace->name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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) {
|
||||
|
||||
Reference in New Issue
Block a user