Merge pull request #716 from marcoAntonioNina/BUG-9902
BUG 9902 Error uploading a new language in Zend Server SOLVED
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -290,13 +290,25 @@ class Content extends BaseContent {
|
||||
foreach ($langs as $key=>$value) {
|
||||
$this->langsAsoc[$value] = $value;
|
||||
}
|
||||
|
||||
|
||||
$this->langs = $langs;
|
||||
$this->rowsProcessed = 0;
|
||||
$this->rowsInserted = 0;
|
||||
$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");
|
||||
@@ -390,20 +412,18 @@ class Content extends BaseContent {
|
||||
$default['CON_ID'],
|
||||
$value,
|
||||
$default['CON_VALUE']
|
||||
);
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
@@ -261,25 +261,33 @@ class Translation extends BaseTranslation {
|
||||
file_put_contents($filePath, serialize($environments));
|
||||
}
|
||||
|
||||
function removeTranslationEnvironment($locale)
|
||||
{
|
||||
$filePath = $this->envFilePath;
|
||||
if( strpos($locale, self::$localeSeparator) !== false ) {
|
||||
list($LAN_ID, $IC_UID) = explode('-', strtoupper($locale));
|
||||
} else {
|
||||
$LAN_ID = $locale;
|
||||
$IC_UID = '__INTERNATIONAL__';
|
||||
}
|
||||
function removeTranslationEnvironment($locale)
|
||||
{
|
||||
$filePath = $this->envFilePath;
|
||||
if (strpos($locale, self::$localeSeparator) !== false) {
|
||||
list($LAN_ID, $IC_UID) = explode('-', strtoupper($locale));
|
||||
} else {
|
||||
$LAN_ID = $locale;
|
||||
$IC_UID = '__INTERNATIONAL__';
|
||||
}
|
||||
|
||||
if( file_exists($filePath) ) {
|
||||
$environments = unserialize(file_get_contents($filePath));
|
||||
if( ! isset($environments[$LAN_ID][$IC_UID]) )
|
||||
return NULL;
|
||||
|
||||
unset($environments[$LAN_ID][$IC_UID]);
|
||||
file_put_contents($filePath, serialize($environments));
|
||||
if (file_exists($filePath)) {
|
||||
$environments = unserialize(file_get_contents($filePath));
|
||||
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');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getTranslationEnvironments(){
|
||||
$filePath = $this->envFilePath;
|
||||
|
||||
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user