MT-173: The new migrate lists task can have an additional language parameter the same as the cache view regeneration task, but it's entirely optional, if not passed the en language is selected instead.

This commit is contained in:
Gustavo Adolfo Cruz Laura
2016-05-09 13:58:52 -04:00
parent 2fb723bdd2
commit 7459b8bb98
2 changed files with 28 additions and 20 deletions

View File

@@ -363,7 +363,7 @@ function run_database_check($args, $opts) {
}
function run_migrate_new_cases_lists($args, $opts) {
migrate_new_cases_lists("migrate", $args);
migrate_new_cases_lists("migrate", $args, $opts);
}
@@ -776,15 +776,17 @@ function run_check_workspace_disabled_code($args, $opts)
}
}
function migrate_new_cases_lists($command, $args) {
function migrate_new_cases_lists($command, $args, $opts) {
G::LoadSystem('inputfilter');
$filter = new InputFilter();
$opts = $filter->xssFilterHard($opts);
$args = $filter->xssFilterHard($args);
$lang = array_key_exists("lang", $opts) ? $opts['lang'] : 'en';
$workspaces = get_workspaces_from_args($args);
foreach ($workspaces as $workspace) {
print_r("Upgrading database in " . pakeColor::colorize($workspace->name, "INFO") . "\n");
try {
$workspace->migrateList($workspace->name, true);
$workspace->migrateList($workspace->name, true, $lang);
echo "> List tables are done\n";
} catch (Exception $e) {
echo "> Error: ".CLI::error($e->getMessage()) . "\n";