diff --git a/workflow/engine/bin/tasks/cliUpgrade.php b/workflow/engine/bin/tasks/cliUpgrade.php index e682875cf..8fd785622 100755 --- a/workflow/engine/bin/tasks/cliUpgrade.php +++ b/workflow/engine/bin/tasks/cliUpgrade.php @@ -95,15 +95,15 @@ function run_upgrade($command, $args) if (defined('PATH_C')) { rm_dir(PATH_C, true); } - $workspaces = get_workspaces_from_args($args); + $workspaces = get_workspaces_from_args($command); $count = count($workspaces); $first = true; $errors = false; - $buildCacheView = array_key_exists("buildACV", $command); + $buildCacheView = array_key_exists("buildACV", $args); foreach ($workspaces as $index => $workspace) { try { CLI::logging("Upgrading workspaces ($index/$count): " . CLI::info($workspace->name) . "\n"); - $workspace->upgrade($first, $buildCacheView); + $workspace->upgrade($first, $buildCacheView, $workspace->name); $workspace->close(); $first = false; } catch (Exception $e) { diff --git a/workflow/engine/classes/class.wsTools.php b/workflow/engine/classes/class.wsTools.php index 3efad7ef0..9a4c92d90 100755 --- a/workflow/engine/classes/class.wsTools.php +++ b/workflow/engine/classes/class.wsTools.php @@ -290,7 +290,7 @@ class workspaceTools { * Upgrade this workspace Content. * */ - public function upgradeContent() { + public function upgradeContent($workSpace=SYS_SYS) { $this->initPropel(true); require_once('classes/model/Language.php'); G::LoadThirdParty('pear/json', 'class.json'); @@ -304,7 +304,7 @@ class workspaceTools { } require_once('classes/model/Content.php'); $regenerateContent = new Content(); - $regenerateContent->regenerateContent($arrayLang); + $regenerateContent->regenerateContent($arrayLang, $workSpace); } /** diff --git a/workflow/engine/classes/model/Content.php b/workflow/engine/classes/model/Content.php index 43ed87c76..a1fa4e52b 100755 --- a/workflow/engine/classes/model/Content.php +++ b/workflow/engine/classes/model/Content.php @@ -276,7 +276,7 @@ class Content extends BaseContent { * * @param array $langs */ - function regenerateContent($langs) + function regenerateContent($langs, $workSpace=SYS_SYS) { //Search the language $key = array_search('en',$langs); @@ -312,18 +312,25 @@ class Content extends BaseContent { $sql = " SELECT CON_ID, CON_CATEGORY, CON_LANG, CON_PARENT, CON_VALUE FROM CONTENT - ORDER BY CON_ID, CON_CATEGORY, CON_LANG, CON_PARENT "; + ORDER BY CON_ID, CON_CATEGORY, CON_PARENT, CON_LANG"; + + G::LoadClass("wsTools"); + $workSpace = new workspaceTools($workSpace); + $workSpace->getDBInfo(); + + $link = mysql_pconnect($workSpace->dbHost, $workSpace->dbUser, $workSpace->dbPass) + or die ("Could not connect"); + + mysql_select_db($workSpace->dbName, $link); mysql_query('SET OPTION SQL_BIG_SELECTS=1'); - $result = mysql_unbuffered_query($sql); + $result = mysql_unbuffered_query($sql, $link); $list = array(); $default = array(); $sw = array('CON_ID'=>'','CON_CATEGORY'=>'','CON_PARENT'=>''); while ($row = mysql_fetch_assoc($result)) { if ($sw['CON_ID'] == $row['CON_ID'] && $sw['CON_CATEGORY'] == $row['CON_CATEGORY'] && $sw['CON_PARENT'] == $row['CON_PARENT']) { $list[] = $row; - if ($sw['CON_LANG'] == $langs[$key]) { - $default = $row; - } + } else { $this->rowsClustered++; if (count($langs) != count($list)) { @@ -342,6 +349,9 @@ class Content extends BaseContent { $default = array(); $list[] = $row; } + if ($sw['CON_LANG'] == $langs[$key]) { + $default = $row; + } $this->rowsProcessed++; } if (count($langs) != count($list)) { @@ -352,11 +362,13 @@ class Content extends BaseContent { mysql_free_result($result); $total = $this->rowsProcessed + $this->rowsInserted; - CLI::logging("Rows Processed ---> $this->rowsProcessed ..... \n"); - CLI::logging("Rows Clustered ---> $this->rowsClustered ..... \n"); - CLI::logging("Rows Unchanged ---> $this->rowsUnchanged ..... \n"); - CLI::logging("Rows Inserted ---> $this->rowsInserted ..... \n"); - CLI::logging("Rows Total ---> $total ..... \n"); + if (!isset($_SERVER['SERVER_NAME'])) { + CLI::logging("Rows Processed ---> $this->rowsProcessed ..... \n"); + CLI::logging("Rows Clustered ---> $this->rowsClustered ..... \n"); + CLI::logging("Rows Unchanged ---> $this->rowsUnchanged ..... \n"); + CLI::logging("Rows Inserted ---> $this->rowsInserted ..... \n"); + CLI::logging("Rows Total ---> $total ..... \n"); + } } function checkLanguage($content, $default) diff --git a/workflow/engine/methods/setup/languages_Import.php b/workflow/engine/methods/setup/languages_Import.php index 17547f7c9..f8ad6e300 100755 --- a/workflow/engine/methods/setup/languages_Import.php +++ b/workflow/engine/methods/setup/languages_Import.php @@ -73,7 +73,7 @@ try { G::LoadClass("wsTools"); $renegerateContent = new workspaceTools(SYS_SYS); - $renegerateContent->upgradeContent(); + $messs = $renegerateContent->upgradeContent(); $result->msg = G::LoadTranslation('IMPORT_LANGUAGE_SUCCESS') . "\n"; $result->msg .= "PO File num. records: " . $importResults->recordsCount . "\n"; @@ -83,7 +83,7 @@ try { if( $importResults->errMsg != '' ){ $result->msg .= "Errors registered: \n" . $importResults->errMsg . "\n"; } - + //$result->msg = htmlentities($result->msg); $result->success = true;