Merge pull request #716 from marcoAntonioNina/BUG-9902

BUG 9902 Error uploading a new language in Zend Server SOLVED
This commit is contained in:
julceslauhub
2012-10-11 08:28:06 -07:00
4 changed files with 66 additions and 41 deletions

View File

@@ -292,15 +292,12 @@ class workspaceTools {
*/
public function upgradeContent($workSpace=SYS_SYS) {
$this->initPropel(true);
require_once('classes/model/Language.php');
G::LoadThirdParty('pear/json', 'class.json');
$lang = array();
foreach (System::listPoFiles() as $poFile) {
$poName = basename($poFile);
$names = explode(".", basename($poFile));
$extension = array_pop($names);
$langid = array_pop($names);
$arrayLang[] = $langid;
require_once 'classes/model/Translation.php';
$translation = new Translation();
$information = $translation->getTranslationEnvironments();
$arrayLang = array();
foreach ($information as $key => $value) {
$arrayLang[] = trim($value['LOCALE']);
}
require_once('classes/model/Content.php');
$regenerateContent = new Content();

View File

@@ -297,6 +297,18 @@ class Content extends BaseContent {
$this->rowsUnchanged = 0;
$this->rowsClustered = 0;
//Creating table CONTENT_BACKUP
$oConnection = Propel::getConnection('workflow');
$oStatement = $oConnection->prepareStatement("CREATE TABLE IF NOT EXISTS `CONTENT_BACKUP` (
`CON_CATEGORY` VARCHAR(30) default '' NOT NULL,
`CON_PARENT` VARCHAR(32) default '' NOT NULL,
`CON_ID` VARCHAR(100) default '' NOT NULL,
`CON_LANG` VARCHAR(10) default '' NOT NULL,
`CON_VALUE` MEDIUMTEXT NOT NULL,
CONSTRAINT CONTENT_BACKUP_PK PRIMARY KEY (CON_CATEGORY,CON_PARENT,CON_ID,CON_LANG)
)Engine=MyISAM DEFAULT CHARSET='utf8' COMMENT='Table for add content';");
$oStatement->executeQuery();
$con = Propel::getConnection('workflow');
$sql = " SELECT DISTINCT CON_LANG
FROM CONTENT ";
@@ -329,9 +341,10 @@ class Content extends BaseContent {
$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']) {
if ($sw['CON_ID'] == $row['CON_ID'] &&
$sw['CON_CATEGORY'] == $row['CON_CATEGORY'] &&
$sw['CON_PARENT'] == $row['CON_PARENT']) {
$list[] = $row;
} else {
$this->rowsClustered++;
if (count($langs) != count($list)) {
@@ -363,6 +376,15 @@ class Content extends BaseContent {
mysql_free_result($result);
$total = $this->rowsProcessed + $this->rowsInserted;
$connection = Propel::getConnection('workflow');
$statement = $connection->prepareStatement("INSERT INTO CONTENT
SELECT CON_CATEGORY, CON_PARENT, CON_ID , CON_LANG, CON_VALUE
FROM CONTENT_BACKUP");
$statement->executeQuery();
$statement = $connection->prepareStatement("DROP TABLE CONTENT_BACKUP");
$statement->executeQuery();
if (!isset($_SERVER['SERVER_NAME'])) {
CLI::logging("Rows Processed ---> $this->rowsProcessed ..... \n");
CLI::logging("Rows Clustered ---> $this->rowsClustered ..... \n");
@@ -396,14 +418,12 @@ class Content extends BaseContent {
}
function fastInsertContent ($ConCategory, $ConParent, $ConId, $ConLang, $ConValue) {
$con = new Content ( );
$con->setConCategory ( $ConCategory );
$con->setConParent ( $ConParent );
$con->setConId ( $ConId );
$con->setConLang ( $ConLang );
$con->setConValue ( $ConValue );
$res = $con->save ();
return $res;
$ConValue = mysql_real_escape_string($ConValue);
$connection = Propel::getConnection('workflow');
$statement = $connection->prepareStatement("INSERT INTO CONTENT_BACKUP (
CON_CATEGORY, CON_PARENT, CON_ID , CON_LANG, CON_VALUE)
VALUES ('$ConCategory', '$ConParent', '$ConId', '$ConLang', '$ConValue');");
$statement->executeQuery();
}
function removeLanguageContent($lanId) {
@@ -422,7 +442,7 @@ class Content extends BaseContent {
$row = $result->getRow ();
while ( is_array ( $row ) ) {
$content = ContentPeer::retrieveByPK( $row['CON_CATEGORY'], '', $row['CON_ID'], $lanId);
$content = ContentPeer::retrieveByPK( $row['CON_CATEGORY'], $row['CON_PARENT'], $row['CON_ID'], $lanId);
if( $content !== null )
$content->delete();

View File

@@ -273,11 +273,19 @@ class Translation extends BaseTranslation {
if (file_exists($filePath)) {
$environments = unserialize(file_get_contents($filePath));
if( ! isset($environments[$LAN_ID][$IC_UID]) )
if (!isset($environments[$LAN_ID][$IC_UID])) {
return NULL;
}
unset($environments[$LAN_ID][$IC_UID]);
file_put_contents($filePath, serialize($environments));
if (file_exists(PATH_CORE . "META-INF" . PATH_SEP . "translation.".$locale)) {
G::rm_dir(PATH_DATA . "META-INF" . PATH_SEP . "translation.".$locale);
}
if (file_exists(PATH_CORE . PATH_SEP . 'content' . PATH_SEP . 'translations' . PATH_SEP . 'processmaker' . $locale . '.po')) {
G::rm_dir(PATH_CORE . PATH_SEP . 'content' . PATH_SEP . 'translations' . PATH_SEP . 'processmaker' . $locale . '.po');
}
}
}

View File

@@ -24,7 +24,7 @@ var removeOption;
var installOption;
var exportOption;
Ext.Ajax.timeout = 300000;
Ext.onReady(function(){
//Ext.state.Manager.setProvider(new Ext.state.CookieProvider());