_toolkit =& $instance; } /** * Replace any mensions of "/kernel/" in database to "/system/" * * @param string $mode when called mode {before, after) */ function Upgrade_4_3_1($mode) { if ($mode == 'after') { // Tables: PageContent, Images if ($this->Conn->TableFound('PageContent')) { // 1. replaces "/kernel/user_files/" references in content blocks $ml_helper =& $this->Application->recallObject('kMultiLanguageHelper'); /* @var $ml_helper kMultiLanguageHelper */ $language_count = $ml_helper->getLanguageCount(); $replace_sql = '%1$s = REPLACE(%1$s, "/kernel/user_files/", "/system/user_files/")'; $update_sqls = Array (); for ($i = 1; $i <= $language_count; $i++) { if (!$ml_helper->LanguageFound($i)) { continue; } $field = 'l' . $i . '_Content'; $update_sqls[] = sprintf($replace_sql, $field); } if ($update_sqls) { $sql = 'UPDATE ' . TABLE_PREFIX . 'PageContent SET ' . implode(', ', $update_sqls); $this->Conn->Query($sql); } } // 2. replace path of images uploaded via "Images" tab of category items $this->_replaceImageFolder('/kernel/images/', '/system/images/'); // 3. replace path of images uploaded via "Images" tab of category items (when badly formatted) $this->_replaceImageFolder('kernel/images/', 'system/images/'); // 4. replace images uploaded via "In-Bulletin -> Emoticons" section $this->_replaceImageFolder('in-bulletin/images/emoticons/', 'system/images/emoticons/'); // 5. update backup path in config $this->_toolkit->saveConfigValues( Array ( 'Backup_Path' => FULL_PATH . '/system/backupdata' ) ); } } /** * Replaces mentions of "/kernel/images" folder in Images table * * @param string $from * @param string $to */ function _replaceImageFolder($from, $to) { $replace_sql = '%1$s = REPLACE(%1$s, "' . $from . '", "' . $to . '")'; $sql = 'UPDATE ' . TABLE_PREFIX . 'Images SET ' . sprintf($replace_sql, 'ThumbPath') . ', ' . sprintf($replace_sql, 'LocalPath'); $this->Conn->Query($sql); } } ?>