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:
@@ -363,7 +363,7 @@ function run_database_check($args, $opts) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function run_migrate_new_cases_lists($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);
|
$workspaces = get_workspaces_from_args($args);
|
||||||
|
|
||||||
foreach ($workspaces as $workspace) {
|
foreach ($workspaces as $workspace) {
|
||||||
print_r("Upgrading database in " . pakeColor::colorize($workspace->name, "INFO") . "\n");
|
print_r("Upgrading database in " . pakeColor::colorize($workspace->name, "INFO") . "\n");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$workspace->migrateList($workspace->name, true);
|
$workspace->migrateList($workspace->name, true, $lang);
|
||||||
|
|
||||||
echo "> List tables are done\n";
|
echo "> List tables are done\n";
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
echo "> Error: ".CLI::error($e->getMessage()) . "\n";
|
echo "> Error: ".CLI::error($e->getMessage()) . "\n";
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ class workspaceTools
|
|||||||
|
|
||||||
$start = microtime(true);
|
$start = microtime(true);
|
||||||
CLI::logging("> Migrate new lists...\n");
|
CLI::logging("> Migrate new lists...\n");
|
||||||
$this->migrateList($workSpace);
|
$this->migrateList($workSpace, false, $lang);
|
||||||
$stop = microtime(true);
|
$stop = microtime(true);
|
||||||
$final = $stop - $start;
|
$final = $stop - $start;
|
||||||
CLI::logging("<*> Migrate new lists Process took $final seconds.\n");
|
CLI::logging("<*> Migrate new lists Process took $final seconds.\n");
|
||||||
@@ -1704,7 +1704,7 @@ class workspaceTools
|
|||||||
) {
|
) {
|
||||||
$start = microtime(true);
|
$start = microtime(true);
|
||||||
CLI::logging("> Updating List tables...\n");
|
CLI::logging("> Updating List tables...\n");
|
||||||
$workspace->migrateList($workspace->name);
|
$workspace->migrateList($workspace->name, false, $lang);
|
||||||
$stop = microtime(true);
|
$stop = microtime(true);
|
||||||
CLI::logging("<*> Updating List Process took " . ($stop - $start) . " seconds.\n");
|
CLI::logging("<*> Updating List Process took " . ($stop - $start) . " seconds.\n");
|
||||||
}
|
}
|
||||||
@@ -1970,7 +1970,7 @@ class workspaceTools
|
|||||||
*
|
*
|
||||||
* return all LIST TABLES with data
|
* return all LIST TABLES with data
|
||||||
*/
|
*/
|
||||||
public function migrateList($workSpace, $flagReinsert = false)
|
public function migrateList($workSpace, $flagReinsert = false, $lang='en')
|
||||||
{
|
{
|
||||||
$this->initPropel(true);
|
$this->initPropel(true);
|
||||||
|
|
||||||
@@ -2004,13 +2004,13 @@ class workspaceTools
|
|||||||
$criteriaWhere->add(UsersPeer::USR_UID, null, Criteria::ISNOTNULL);
|
$criteriaWhere->add(UsersPeer::USR_UID, null, Criteria::ISNOTNULL);
|
||||||
|
|
||||||
BasePeer::doUpdate($criteriaWhere, $criteriaSet, Propel::getConnection("workflow"));
|
BasePeer::doUpdate($criteriaWhere, $criteriaSet, Propel::getConnection("workflow"));
|
||||||
$this->regenerateListCompleted();
|
$this->regenerateListCompleted($lang);
|
||||||
$this->regenerateListCanceled();
|
$this->regenerateListCanceled($lang);
|
||||||
$this->regenerateListMyInbox();
|
$this->regenerateListMyInbox(); // this list require no translation
|
||||||
$this->regenerateListInbox();
|
$this->regenerateListInbox(); // this list require no translation
|
||||||
$this->regenerateListParticipatedHistory();
|
$this->regenerateListParticipatedHistory(); // this list require no translation
|
||||||
$this->regenerateListParticipatedLast();
|
$this->regenerateListParticipatedLast(); // this list require no translation
|
||||||
$this->regenerateListPaused();
|
$this->regenerateListPaused(); // this list require no translation
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -2025,7 +2025,7 @@ class workspaceTools
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function regenerateListCanceled()
|
public function regenerateListCanceled($lang = 'en')
|
||||||
{
|
{
|
||||||
$this->initPropel(true);
|
$this->initPropel(true);
|
||||||
$query = 'INSERT INTO '.$this->dbName.'.LIST_CANCELED
|
$query = 'INSERT INTO '.$this->dbName.'.LIST_CANCELED
|
||||||
@@ -2070,10 +2070,13 @@ class workspaceTools
|
|||||||
('.$this->dbName.'.APP_CACHE_VIEW ACV
|
('.$this->dbName.'.APP_CACHE_VIEW ACV
|
||||||
LEFT JOIN '.$this->dbName.'.CONTENT C_APP ON ACV.APP_UID = C_APP.CON_ID
|
LEFT JOIN '.$this->dbName.'.CONTENT C_APP ON ACV.APP_UID = C_APP.CON_ID
|
||||||
AND C_APP.CON_CATEGORY = \'APP_TITLE\'
|
AND C_APP.CON_CATEGORY = \'APP_TITLE\'
|
||||||
|
AND C_APP.CON_LANG = \''.$lang.'\'
|
||||||
LEFT JOIN '.$this->dbName.'.CONTENT C_PRO ON ACV.PRO_UID = C_PRO.CON_ID
|
LEFT JOIN '.$this->dbName.'.CONTENT C_PRO ON ACV.PRO_UID = C_PRO.CON_ID
|
||||||
AND C_PRO.CON_CATEGORY = \'PRO_TITLE\'
|
AND C_PRO.CON_CATEGORY = \'PRO_TITLE\'
|
||||||
|
AND C_PRO.CON_LANG = \''.$lang.'\'
|
||||||
LEFT JOIN '.$this->dbName.'.CONTENT C_TAS ON ACV.TAS_UID = C_TAS.CON_ID
|
LEFT JOIN '.$this->dbName.'.CONTENT C_TAS ON ACV.TAS_UID = C_TAS.CON_ID
|
||||||
AND C_TAS.CON_CATEGORY = \'TAS_TITLE\')
|
AND C_TAS.CON_CATEGORY = \'TAS_TITLE\'
|
||||||
|
AND C_TAS.CON_LANG = \''.$lang.'\')
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
('.$this->dbName.'.APP_DELEGATION AD
|
('.$this->dbName.'.APP_DELEGATION AD
|
||||||
INNER JOIN '.$this->dbName.'.APP_DELEGATION PREV_AD ON AD.APP_UID = PREV_AD.APP_UID
|
INNER JOIN '.$this->dbName.'.APP_DELEGATION PREV_AD ON AD.APP_UID = PREV_AD.APP_UID
|
||||||
@@ -2090,7 +2093,7 @@ class workspaceTools
|
|||||||
CLI::logging("> Completed table LIST_CANCELED\n");
|
CLI::logging("> Completed table LIST_CANCELED\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
public function regenerateListCompleted(){
|
public function regenerateListCompleted($lang = 'en'){
|
||||||
$this->initPropel(true);
|
$this->initPropel(true);
|
||||||
$query = 'INSERT INTO '.$this->dbName.'.LIST_COMPLETED
|
$query = 'INSERT INTO '.$this->dbName.'.LIST_COMPLETED
|
||||||
(APP_UID,
|
(APP_UID,
|
||||||
@@ -2129,10 +2132,13 @@ class workspaceTools
|
|||||||
('.$this->dbName.'.APP_CACHE_VIEW ACV
|
('.$this->dbName.'.APP_CACHE_VIEW ACV
|
||||||
LEFT JOIN '.$this->dbName.'.CONTENT C_APP ON ACV.APP_UID = C_APP.CON_ID
|
LEFT JOIN '.$this->dbName.'.CONTENT C_APP ON ACV.APP_UID = C_APP.CON_ID
|
||||||
AND C_APP.CON_CATEGORY = \'APP_TITLE\'
|
AND C_APP.CON_CATEGORY = \'APP_TITLE\'
|
||||||
|
AND C_APP.CON_LANG = \''.$lang.'\'
|
||||||
LEFT JOIN '.$this->dbName.'.CONTENT C_PRO ON ACV.PRO_UID = C_PRO.CON_ID
|
LEFT JOIN '.$this->dbName.'.CONTENT C_PRO ON ACV.PRO_UID = C_PRO.CON_ID
|
||||||
AND C_PRO.CON_CATEGORY = \'PRO_TITLE\'
|
AND C_PRO.CON_CATEGORY = \'PRO_TITLE\'
|
||||||
|
AND C_PRO.CON_LANG = \''.$lang.'\'
|
||||||
LEFT JOIN '.$this->dbName.'.CONTENT C_TAS ON ACV.TAS_UID = C_TAS.CON_ID
|
LEFT JOIN '.$this->dbName.'.CONTENT C_TAS ON ACV.TAS_UID = C_TAS.CON_ID
|
||||||
AND C_TAS.CON_CATEGORY = \'TAS_TITLE\')
|
AND C_TAS.CON_CATEGORY = \'TAS_TITLE\'
|
||||||
|
AND C_TAS.CON_LANG = \''.$lang.'\')
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
('.$this->dbName.'.APP_DELEGATION AD
|
('.$this->dbName.'.APP_DELEGATION AD
|
||||||
INNER JOIN '.$this->dbName.'.APP_DELEGATION PREV_AD ON AD.APP_UID = PREV_AD.APP_UID
|
INNER JOIN '.$this->dbName.'.APP_DELEGATION PREV_AD ON AD.APP_UID = PREV_AD.APP_UID
|
||||||
|
|||||||
Reference in New Issue
Block a user