Index: branches/5.1.x/core/install/upgrades.php =================================================================== diff -u -r13635 -r13780 --- branches/5.1.x/core/install/upgrades.php (.../upgrades.php) (revision 13635) +++ branches/5.1.x/core/install/upgrades.php (.../upgrades.php) (revision 13780) @@ -1,6 +1,6 @@ _toolkit =& $instance; - } - - /** * Changes table structure, where multilingual fields of TEXT type are present * * @param string $mode when called mode {before, after) @@ -228,8 +211,8 @@ { // 1. find In-Portal old Conn->GetCol($sql)); // 2. replace In-Portal old $new_tag) { $sql = 'UPDATE '.TABLE_PREFIX.'EmailMessage - SET Template = REPLACE(Template, '.$this->Conn->qstr($old_tag).', '.$this->Conn->qstr($new_tag).') - WHERE EventId IN ('.$event_ids.')'; + SET Template = REPLACE(Template, '.$this->Conn->qstr($old_tag).', '.$this->Conn->qstr($new_tag).') + WHERE EventId IN ('.$event_ids.')'; $this->Conn->Query($sql); } if ($mode == 'after') { $this->_insertInPortalData(); - $this->_removeDuplicatePhrases(); $this->_moveDatabaseFolders(); // in case, when In-Portal module is enabled -> turn AdvancedUserManagement on too @@ -264,6 +246,10 @@ $this->Conn->Query($sql); } } + + if ($mode == 'languagepack') { + $this->_removeDuplicatePhrases(); + } } function _insertInPortalData() @@ -771,7 +757,7 @@ * @param string $module_name * @return int */ - function _getRootCategory($module_name) + function _getRootCategory($module_name, $module_prefix) { // don't cache anything here (like in static variables), because database value is changed on the fly !!! $sql = 'SELECT RootCat @@ -782,6 +768,7 @@ // put to cache too, because CategoriesEventHandler::_prepareAutoPage uses kApplication::findModule $this->Application->ModuleInfo[$module_name]['Name'] = $module_name; $this->Application->ModuleInfo[$module_name]['RootCat'] = $root_category; + $this->Application->ModuleInfo[$module_name]['Var'] = $module_prefix; return $root_category; } @@ -792,7 +779,7 @@ */ function _restructureCatalog() { - $root_category = $this->_getRootCategory('Core'); + $root_category = $this->_getRootCategory('Core', 'adm'); $sql = 'SELECT CategoryId FROM ' . TABLE_PREFIX . 'Category @@ -863,6 +850,13 @@ // option: from -> to 'HeadBgColor' => Array ('#1961B8', '#007BF4'), 'HeadBarColor' => Array ('#FFFFFF', '#000000'), + + 'HeadColor' => Array ('#CCFF00', '#FFFFFF'), + 'TreeColor' => Array ('#006F99', '#000000'), + 'TreeHoverColor' => Array ('', '#009FF0'), + 'TreeHighHoverColor' => Array ('', '#FFFFFF'), + 'TreeHighBgColor' => Array ('#4A92CE', '#4A92CE'), + 'TreeBgColor' => Array ('#FFFFFF', '#DCECF6'), ); $can_change = true; @@ -909,7 +903,7 @@ function _createProjCMSTables() { // 0. make sure, that Content category exists - $root_category = $this->_getRootCategory('Proj-CMS'); + $root_category = $this->_getRootCategory('Proj-CMS', 'st'); if ($root_category) { // proj-cms module found -> remove it $sql = 'DELETE FROM ' . TABLE_PREFIX . 'Modules @@ -925,7 +919,7 @@ WHERE (Status = 4) AND (CategoryId <> ' . $root_category . ')'; $this->Conn->Query($sql); } else { - $root_category = $this->_getRootCategory('In-Edit'); + $root_category = $this->_getRootCategory('In-Edit', 'cms'); if ($root_category) { // in-edit module found -> remove it $sql = 'DELETE FROM ' . TABLE_PREFIX . 'Modules @@ -1414,13 +1408,6 @@ function Upgrade_5_1_0_B1($mode) { if ($mode == 'before') { - // create multilingual fields for phrases and email events - $ml_helper =& $this->Application->recallObject('kMultiLanguageHelper'); - /* @var $ml_helper kMultiLanguageHelper */ - - $ml_helper->createFields('phrases'); - $ml_helper->createFields('emailevents'); - // migrate email events $table_structure = $this->Conn->Query('DESCRIBE ' . TABLE_PREFIX . 'Events', 'Field'); @@ -1431,6 +1418,31 @@ $this->Conn->Query($sql); } + // alter here, because kMultiLanguageHelper::createFields + // method, called after will expect that to be in database + $sql = 'ALTER TABLE ' . TABLE_PREFIX . 'Events + ADD AllowChangingSender TINYINT NOT NULL DEFAULT "0" AFTER MessageType , + ADD CustomSender TINYINT NOT NULL DEFAULT "0" AFTER AllowChangingSender , + ADD SenderName VARCHAR(255) NOT NULL DEFAULT "" AFTER CustomSender , + ADD SenderAddressType TINYINT NOT NULL DEFAULT "0" AFTER SenderName , + ADD SenderAddress VARCHAR(255) NOT NULL DEFAULT "" AFTER SenderAddressType , + ADD AllowChangingRecipient TINYINT NOT NULL DEFAULT "0" AFTER SenderAddress , + ADD CustomRecipient TINYINT NOT NULL DEFAULT "0" AFTER AllowChangingRecipient , + ADD Recipients TEXT AFTER CustomRecipient, + ADD INDEX (AllowChangingSender), + ADD INDEX (CustomSender), + ADD INDEX (SenderAddressType), + ADD INDEX (AllowChangingRecipient), + ADD INDEX (CustomRecipient)'; + $this->Conn->Query($sql); + + // create multilingual fields for phrases and email events + $ml_helper =& $this->Application->recallObject('kMultiLanguageHelper'); + /* @var $ml_helper kMultiLanguageHelper */ + + $ml_helper->createFields('phrases'); + $ml_helper->createFields('emailevents'); + if ($this->Conn->TableFound(TABLE_PREFIX . 'EmailMessage')) { $email_message_helper =& $this->Application->recallObject('EmailMessageHelper'); /* @var $email_message_helper EmailMessageHelper */ @@ -1526,6 +1538,7 @@ if ($mode == 'after') { $this->_transformEmailRecipients(); + $this->_fixSkinColors(); } }