/** * upgrade * * @todo recode using DBUtil */ public function Upgrade($oldversion) { switch ($oldversion) { case '0.2': // Create the system init hook (previous versions are for Zikula 1.2) EventUtil::registerPersistentModuleHandler('IWstats', 'core.postinit', array('IWstats_Listeners', 'coreinit')); case '3.0.0': // Add new fields. Stop in case of error if (!DBUtil::changeTable('IWstats')) { return false; } // Create indexes. Don't stop in case of error $table = pnDBGetTables(); $c = $table['IWstats_column']; DBUtil::createIndex($c['ipForward'], 'IWstats', 'ipForward'); DBUtil::createIndex($c['ipClient'], 'IWstats', 'ipClient'); DBUtil::createIndex($c['userAgent'], 'IWstats', 'userAgent'); break; } // Update successful return true; }
/** * upgrade the module from an old version * * This function must consider all the released versions of the module! * If the upgrade fails at some point, it returns the last upgraded version. * * @param string $oldVersion version number string to upgrade from * @return mixed true on success, last valid version string or false if fails */ public function upgrade($oldversion) { // Upgrade dependent on old version number switch ($oldversion) { case '3.6': // Rename 'thelang' block. $table = 'blocks'; $sql = "UPDATE {$table} SET bkey = 'lang' WHERE bkey = 'thelang'"; DBUtil::executeSQL($sql); // Optional upgrade if (in_array(DBUtil::getLimitedTablename('message'), DBUtil::metaTables())) { $this->migrateMessages(); } $this->migrateBlockNames(); $this->migrateExtMenu(); case '3.7': case '3.7.0': if (!DBUtil::changeTable('blocks')) { return false; } case '3.7.1': $this->newBlockPositions(); case '3.8.0': // future upgrade routines } // Update successful return true; }
/** * upgrade the module from an old version * * This function must consider all the released versions of the module! * If the upgrade fails at some point, it returns the last upgraded version. * * @param string $oldVersion version number string to upgrade from * @return mixed true on success, last valid version string or false if fails */ public function upgrade($oldversion) { // Upgrade dependent on old version number switch ($oldversion) { case '1.5': if (!DBUtil::changeTable('admin_module')) { return '1.5'; } case '1.6': $this->setVar('modulesperrow', 3); $this->setVar('itemsperpage', 15); $this->setVar('moduledescription', 1); case '1.7': case '1.8': $this->delVar('moduledescription'); case '1.8.1': if (!DBUtil::changeTable('admin_category')) { return '1.8.1'; } if (!DBUtil::changeTable('admin_module')) { return '1.8.1'; } case '1.9.0': // future upgrade routines } // Update successful return true; }
/** * upgrade the module from an old version * * This function must consider all the released versions of the module! * If the upgrade fails at some point, it returns the last upgraded version. * * @param string $oldVersion version number string to upgrade from * @return mixed true on success, last valid version string or false if fails */ public function upgrade($oldversion) { // Upgrade dependent on old version number switch ($oldversion) { case '3.6': // Rename 'thelang' block. $table = 'blocks'; $sql = "UPDATE {$table} SET bkey = 'lang' WHERE bkey = 'thelang'"; \DBUtil::executeSQL($sql); // Optional upgrade if (in_array(\DBUtil::getLimitedTablename('message'), \DBUtil::metaTables())) { $this->migrateMessages(); } $this->migrateBlockNames(); $this->migrateExtMenu(); case '3.7': case '3.7.0': if (!\DBUtil::changeTable('blocks')) { return false; } case '3.7.1': $this->newBlockPositions(); case '3.8.0': // update empty filter fields to an empty array $entity = $this->name . '\\Entity\\Block'; $dql = "UPDATE {$entity} p SET p.filter = 'a:0:{}' WHERE p.filter = '' OR p.filter = 's:0:\"\";'"; $query = $this->entityManager->createQuery($dql); $query->getResult(); case '3.8.1': // future upgrade routines } // Update successful return true; }
/** * upgrade the module from an old version * * This function must consider all the released versions of the module! * If the upgrade fails at some point, it returns the last upgraded version. * * @param string $oldVersion version number string to upgrade from * @return mixed true on success, last valid version string or false if fails */ public function upgrade($oldversion) { // Upgrade dependent on old version number switch ($oldversion) { case '3.6': // Rename 'thelang' block. $table = 'blocks'; $sql = "UPDATE $table SET bkey = 'lang' WHERE bkey = 'thelang'"; DBUtil::executeSQL($sql); // Optional upgrade if (in_array(DBUtil::getLimitedTablename('message'), DBUtil::metaTables())) { $this->migrateMessages(); } $this->migrateBlockNames(); $this->migrateExtMenu(); case '3.7': case '3.7.0': if (!DBUtil::changeTable('blocks')) { return false; } case '3.7.1': $this->newBlockPositions(); case '3.8.0': // update empty filter fields to an empty array $entity = $this->name . '_Entity_Block'; $dql = "UPDATE $entity p SET p.filter = 'a:0:{}' WHERE p.filter = '' OR p.filter = 's:0:\"\";' OR p.filter = 'a:3:{s:4:\"type\";s:0:\"\";s:9:\"functions\";s:0:\"\";s:10:\"customargs\";s:0:\"\";}'"; $query = $this->entityManager->createQuery($dql); $query->getResult(); case '3.8.1': // register ui_hooks for HTML block editing HookUtil::registerSubscriberBundles($this->version->getHookSubscriberBundles()); case '3.8.2': // future upgrade routines } // Update successful return true; }
/** * Upgrade the module from an old version. * * This function must consider all the released versions of the module! * If the upgrade fails at some point, it returns the last upgraded version. * * @param string $oldVersion Version number string to upgrade from. * * @return boolean|string True on success, last valid version string or false if fails. */ public function upgrade($oldversion) { // Upgrade dependent on old version number switch ($oldversion) { case '3.6': case '3.7': // legacy is no longer supported System::delVar('loadlegacy'); DBUtil::changeTable('modules'); case '3.7.4': case '3.7.5': case '3.7.6': case '3.7.8': // create the new hooks tables Doctrine_Core::createTablesFromArray(array('Zikula_Doctrine_Model_HookArea', 'Zikula_Doctrine_Model_HookProvider', 'Zikula_Doctrine_Model_HookSubscriber', 'Zikula_Doctrine_Model_HookBinding', 'Zikula_Doctrine_Model_HookRuntime')); EventUtil::registerPersistentModuleHandler('Extensions', 'controller.method_not_found', array('Extensions_HookUI', 'hooks')); EventUtil::registerPersistentModuleHandler('Extensions', 'controller.method_not_found', array('Extensions_HookUI', 'moduleservices')); case '3.7.9': // increase length of some hook table fields from 60 to 100 $commands = array(); $commands[] = "ALTER TABLE hook_area CHANGE areaname areaname VARCHAR(100) NOT NULL"; $commands[] = "ALTER TABLE hook_runtime CHANGE eventname eventname VARCHAR(100) NOT NULL"; $commands[] = "ALTER TABLE hook_subscriber CHANGE eventname eventname VARCHAR(100) NOT NULL"; // Load DB connection $dbEvent = new Zikula_Event('doctrine.init_connection'); $connection = $this->eventManager->notify($dbEvent)->getData(); foreach ($commands as $sql) { $stmt = $connection->prepare($sql); $stmt->execute(); } case '3.7.10': // future upgrade routines } // Update successful return true; }
/** * Upgrade the module from an old version. * * This function must consider all the released versions of the module! * If the upgrade fails at some point, it returns the last upgraded version. * * @param string $oldVersion Version number string to upgrade from. * * @return boolean|string True on success, last valid version string or false if fails. */ public function upgrade($oldversion) { // Upgrade dependent on old version number switch ($oldversion) { case '3.6': case '3.7': // legacy is no longer supported System::delVar('loadlegacy'); DBUtil::changeTable('modules'); case '3.7.4': case '3.7.5': case '3.7.6': case '3.7.8': // create the new hooks tables Doctrine_Core::createTablesFromArray(array('Zikula_Doctrine_Model_HookArea', 'Zikula_Doctrine_Model_HookProvider', 'Zikula_Doctrine_Model_HookSubscriber', 'Zikula_Doctrine_Model_HookBinding', 'Zikula_Doctrine_Model_HookRuntime')); EventUtil::registerPersistentModuleHandler('Extensions', 'controller.method_not_found', array('Extensions_HookUI', 'hooks')); EventUtil::registerPersistentModuleHandler('Extensions', 'controller.method_not_found', array('Extensions_HookUI', 'moduleservices')); case '3.7.9': // future upgrade routines } // Update successful return true; }
public function upgrade($oldversion) { if ($oldversion < 1.1) { if (!DBUtil::changeTable('IWjclic')) return false; if (!DBUtil::changeTable('IWjclic_activities')) return false; if (!DBUtil::changeTable('IWjclic_groups')) return false; if (!DBUtil::changeTable('IWjclic_sessions')) return false; if (!DBUtil::changeTable('IWjclic_users')) return false; if (!DBUtil::changeTable('IWjclic_settings')) return false; //Create indexes $tables = DBUtil::getTables(); $c = $tables['IWjclic_column']; if (!DBUtil::createIndex($c['user'], 'IWjclic', 'user')) return false; $c = $tables['IWjclic_activities_column']; if (!DBUtil::createIndex($c['session_id'], 'IWjclic_activities', 'session_id')) return false; $c = $tables['IWjclic_groups_column']; if (!DBUtil::createIndex($c['jid'], 'IWjclic_groups', 'jid')) return false; $c = $tables['IWjclic_sessions_column']; if (!DBUtil::createIndex($c['jclicid'], 'IWjclic_sessions', 'jclicid')) return false; if (!DBUtil::createIndex($c['session_id'], 'IWjclic_sessions', 'session_id')) return false; if (!DBUtil::createIndex($c['user_id'], 'IWjclic_sessions', 'user_id')) return false; $c = $tables['IWjclic_settings_column']; if (!DBUtil::createIndex($c['setting_key'], 'IWjclic_settings', 'setting_key')) return false; $c = $tables['IWjclic_users_column']; if (!DBUtil::createIndex($c['jid'], 'IWjclic_users', 'jid')) return false; } // Update successful return true; }
function mediashare_upgrade_to_3_4_1() { if (!DBUtil::changeTable('mediashare_mediastore')) { return false; } return true; }
/** * upgrade the EZComments module from an old version * * This function upgrades the module to be used. It updates tables, * registers hooks,... * * @return boolean true on success, false otherwise. */ public function upgrade($oldversion) { switch ($oldversion) { case '1.2': $this->setVar('enablepager', false); $this->setVar('commentsperpage', '25'); case '1.3': $this->setVar('blacklinkcount', 5); $this->setVar('akismet', false); case '1.4': $this->setVar('anonusersrequirename', false); $this->setVar('akismetstatus', 1); case '1.5': if (!DBUtil::changeTable('EZComments')) { return '1.5'; } $this->setVar('template', 'Standard'); $this->setVar('modifyowntime', 6); $this->setVar('useaccountpage', '1'); case '1.6': case '1.61': case '1.62': $this->setVar('migrated', array('dummy' => true)); $this->setVar('css', 'style.css'); case '2.0.0': case '2.0.1': // register hooks HookUtil::registerSubscriberBundles($this->version->getHookSubscriberBundles()); HookUtil::registerProviderBundles($this->version->getHookProviderBundles()); // register the module delete hook EventUtil::registerPersistentModuleHandler('EZComments', 'installer.module.uninstalled', array('EZComments_EventHandlers', 'moduleDelete')); EventUtil::registerPersistentModuleHandler('EZComments', 'installer.subscriberarea.uninstalled', array('EZComments_EventHandlers', 'hookAreaDelete')); // drop table prefix $prefix = $this->serviceManager['prefix']; $connection = Doctrine_Manager::getInstance()->getConnection('default'); $sql = 'RENAME TABLE ' . $prefix . '_ezcomments' . " TO ezcomments"; $stmt = $connection->prepare($sql); try { $stmt->execute(); } catch (Exception $e) { } if (!DBUtil::changeTable('EZComments')) { return LogUtil::registerError($this->__('Error updating the table.')); } case '3.0.0': case '3.0.1': // future upgrade routines break; } return true; }
/** * upgrade the Feeds module from an old version * This function can be called multiple times */ public function upgrade($oldversion) { $dom = ZLanguage::getModuleDomain('Feeds'); // when upgrading let's clear the cache directory CacheUtil::clearLocalDir('feeds'); switch ($oldversion) { // version 1.0 shipped with PN .7x case '1.0': // rename table if upgrading from an earlier version if (in_array(DBUtil::getLimitedTablename('RSS'), DBUtil::MetaTables())) { DBUtil::renameTable('RSS', 'feeds'); } if (in_array(DBUtil::getLimitedTablename('rss'), DBUtil::MetaTables())) { DBUtil::renameTable('rss', 'feeds'); } // create cache directory CacheUtil::createLocalDir('feeds'); // migrate module vars $tables = DBUtil::getTables(); $sql = "UPDATE $tables[module_vars] SET pn_modname = 'Feeds' WHERE pn_modname = 'RSS'"; if (!DBUtil::executeSQL($sql)) { LogUtil::registerError(__('Error! Update attempt failed.', $dom)); return '1.0'; } // create our default category $this->setVar('enablecategorization', true); if (!$this->_feeds_createdefaultcategory()) { LogUtil::registerError(__('Error! Update attempt failed.', $dom)); return '1.0'; } // update table if (!DBUtil::changeTable('feeds')) { return '1.0'; } // update the permalinks $shorturlsep = System::getVar('shorturlsseparator'); $sql = "UPDATE $tables[feeds] SET pn_urltitle = REPLACE(pn_name, ' ', '{$shorturlsep}')"; if (!DBUtil::executeSQL($sql)) { LogUtil::registerError(__('Error! Update attempt failed.', $dom)); return '1.0'; } case '2.1': $modvars = array('multifeedlimit' => 0, 'feedsperpage' => 10, 'usingcronjob' => 0, 'key' => md5(time())); if (!ModUtil::setVars('Feeds', $modvars)) { LogUtil::registerError(__('Error! Update attempt failed.', $dom)); return '2.1'; } // 2.2 -> 2.3 is the Gettext change case '2.2': case '2.3': case '2.4': case '2.5': $prefix = $this->serviceManager['prefix']; $connection = Doctrine_Manager::getInstance()->getConnection('default'); $sqlStatements = array(); // N.B. statements generated with PHPMyAdmin $sqlStatements[] = 'RENAME TABLE ' . $prefix . '_feeds' . " TO `feeds`"; $sqlStatements[] = "ALTER TABLE `feeds` CHANGE `pn_fid` `fid` INT( 10 ) NOT NULL AUTO_INCREMENT , CHANGE `pn_name` `name` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '', CHANGE `pn_urltitle` `urltitle` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '', CHANGE `pn_url` `url` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '', CHANGE `pn_obj_status` `obj_status` CHAR( 1 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'A', CHANGE `pn_cr_date` `cr_date` DATETIME NOT NULL DEFAULT '1970-01-01 00:00:00', CHANGE `pn_cr_uid` `cr_uid` INT( 11 ) NOT NULL DEFAULT '0', CHANGE `pn_lu_date` `lu_date` DATETIME NOT NULL DEFAULT '1970-01-01 00:00:00', CHANGE `pn_lu_uid` `lu_uid` INT( 11 ) NOT NULL DEFAULT '0'"; foreach ($sqlStatements as $sql) { $stmt = $connection->prepare($sql); try { $stmt->execute(); } catch (Exception $e) { } } case '2.6.0': $this->delVar('feedsperpage'); case '2.6.1': // further upgrade routine } // update successful return true; }
/** * Upgrade the errors module from an old version * * This function must consider all the released versions of the module! * If the upgrade fails at some point, it returns the last upgraded version. * * @param string $oldversion Version number string to upgrade from. * * @return mixed True on success, last valid version string or false if fails. */ public function upgrade($oldversion) { // rename table if upgrading from an earlier version if (in_array(DBUtil::getLimitedTablename('seccont'), DBUtil::MetaTables())) { DBUtil::renameTable('seccont', 'pages'); DBUtil::renameColumn('pages', 'pn_artid', 'pageid'); } switch ($oldversion) { // 1.0 shipped with .7x case '1.0': // populate permalinks for existing content $tables = DBUtil::getTables(); $shorturlsep = System::getVar('shorturlsseparator'); $sqls = array(); $sqls[] = "UPDATE $tables[pages] SET pn_urltitle = REPLACE(pn_title, ' ', '{$shorturlsep}')"; $sqls[] = "UPDATE $tables[pages] SET pn_cr_date = '".DateUtil::getDatetime()."'"; $sqls[] = "UPDATE $tables[pages] SET pn_displaywrapper = 0"; foreach ($sqls as $sql) { if (!DBUtil::executeSQL($sql)) { return LogUtil::registerError($this->__('Error! Update attempt failed.')); } } $this->setVar('itemsperpage', 25); case '2.0': case '2.1': $this->setVar('enablecategorization', true); $this->setVar('addcategorytitletopermalink', true); ModUtil::dbInfoLoad('Pages', 'Pages', true); if (!$this->_migratecategories()) { LogUtil::registerError($this->__('Error! Update attempt failed.')); return '2.1'; } case '2.2': if (!$this->_migratedisplayvars()) { LogUtil::registerError($this->__('Error! Update attempt failed.')); return '2.2'; } // gettext conversion case '2.3': $this->setVar('showpermalinkinput', true); if (!$this->_migrategtlanguage()) { LogUtil::registerError($this->__('Error! Update attempt failed.')); return '2.3'; } case '2.4': case '2.4.1': case '2.4.2': $prefix = $this->serviceManager['prefix']; $connection = Doctrine_Manager::getInstance()->getConnection('default'); $sqlStatements = array(); // N.B. statements generated with PHPMyAdmin $sqlStatements[] = 'RENAME TABLE ' . $prefix . '_pages' . " TO `pages`"; $sqlStatements[] = "ALTER TABLE `pages` CHANGE `pn_pageid` `pageid` INT( 11 ) NOT NULL AUTO_INCREMENT , CHANGE `pn_title` `title` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL , CHANGE `pn_content` `content` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL , CHANGE `pn_counter` `counter` INT( 11 ) NOT NULL DEFAULT '0', CHANGE `pn_language` `language` VARCHAR( 30 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '', CHANGE `pn_urltitle` `urltitle` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL , CHANGE `pn_displaywrapper` `displaywrapper` TINYINT( 4 ) NOT NULL DEFAULT '1', CHANGE `pn_displaytitle` `displaytitle` TINYINT( 4 ) NOT NULL DEFAULT '1', CHANGE `pn_displaycreated` `displaycreated` TINYINT( 4 ) NOT NULL DEFAULT '1', CHANGE `pn_displayupdated` `displayupdated` TINYINT( 4 ) NOT NULL DEFAULT '1', CHANGE `pn_displaytextinfo` `displaytextinfo` TINYINT( 4 ) NOT NULL DEFAULT '1', CHANGE `pn_displayprint` `displayprint` TINYINT( 4 ) NOT NULL DEFAULT '1', CHANGE `pn_obj_status` `obj_status` CHAR( 1 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'A', CHANGE `pn_cr_date` `cr_date` DATETIME NOT NULL DEFAULT '1970-01-01 00:00:00', CHANGE `pn_cr_uid` `cr_uid` INT( 11 ) NOT NULL DEFAULT '0', CHANGE `pn_lu_date` `lu_date` DATETIME NOT NULL DEFAULT '1970-01-01 00:00:00', CHANGE `pn_lu_uid` `lu_uid` INT( 11 ) NOT NULL DEFAULT '0'"; foreach ($sqlStatements as $sql) { $stmt = $connection->prepare($sql); try { $stmt->execute(); } catch (Exception $e) { } } HookUtil::registerSubscriberBundles($this->version->getHookSubscriberBundles()); // set defaults for modvars that should have been set in 2.2 upgrade $this->resetModVars(); // update table if (!DBUtil::changeTable('pages')) { return '2.4.2'; } // further upgrade routines } // Update successful return true; }
/** * Upgrade quotes module * @author The Zikula Development Team * @return true if init successful, false otherwise */ public function upgrade($oldversion) { // upgrade dependent on old version number switch ($oldversion) { case '1.3': // version 1.3 was shipped with .72x/.75 ModUtil::setVar('Quotes', 'itemsperpage', 25); // we don't need these variables anymore ModUtil::delVar('Quotes', 'detail'); ModUtil::delVar('Quotes', 'table'); case '1.5': // version 1.5 was shipped with .76x // migrate the quotes into the default category if (!$this->_migratecategories()) { return LogUtil::registerError($this->__('Error! Update attempt failed.')); } case '2.0': // remove the mapcatcount variable ModUtil::delVar('Quotes', 'catmapcount'); case '2.1': // add the categorization variable ModUtil::setVar('Quotes', 'enablecategorization', true); case '2.2': case '2.3': case '2.5': $connection = Doctrine_Manager::getInstance()->getConnection('default'); // drop table prefix $prefix = $this->serviceManager['prefix']; $sqlQueries = array(); $sqlQueries[] = 'RENAME TABLE ' . $prefix . '_quotes' . " TO `quotes`"; $sqlQueries[] = "ALTER TABLE `quotes` CHANGE `pn_qid` `qid` INT(11) NOT NULL AUTO_INCREMENT"; $sqlQueries[] = "ALTER TABLE `quotes` CHANGE `pn_quote` `quote` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL"; $sqlQueries[] = "ALTER TABLE `quotes` CHANGE `pn_author` `author` VARCHAR(150) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL"; $sqlQueries[] = "ALTER TABLE `quotes` CHANGE `pn_obj_status` `obj_status` VARCHAR(1) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'A'"; $sqlQueries[] = "ALTER TABLE `quotes` CHANGE `pn_cr_date` `cr_date` DATETIME NOT NULL DEFAULT '1970-01-01 00:00:00'"; $sqlQueries[] = "ALTER TABLE `quotes` CHANGE `pn_cr_uid` `cr_uid` INT(11) NOT NULL DEFAULT '0'"; $sqlQueries[] = "ALTER TABLE `quotes` CHANGE `pn_lu_date` `lu_date` DATETIME NOT NULL DEFAULT '1970-01-01 00:00:00'"; $sqlQueries[] = "ALTER TABLE `quotes` CHANGE `pn_lu_uid` `lu_uid` INT(11) NOT NULL DEFAULT '0'"; $sqlQueries[] = "ALTER TABLE `quotes` CHANGE `pn_status` `status` TINYINT(4) NULL DEFAULT '1'"; foreach ($sqlQueries as $sql) { $stmt = $connection->prepare($sql); try { $stmt->execute(); } catch (Exception $e) { } } // update table structure according to table definition if (!DBUtil::changeTable('quotes')) { return "2.5"; } case '3.0.0': // Register hooks $connection = Doctrine_Manager::getInstance()->getConnection('default'); $sqlQueries = array(); $sqlQueries[] = 'DELETE FROM `hook_area` WHERE `owner`="Quotes"'; $sqlQueries[] = 'DELETE FROM `hook_subscriber` WHERE `owner`="Quotes"'; $sqlQueries[] = 'DELETE FROM `hook_provider` WHERE `owner`="Quotes"'; foreach ($sqlQueries as $sql) { $stmt = $connection->prepare($sql); try { $stmt->execute(); } catch (Exception $e) { } } HookUtil::registerSubscriberBundles($this->version->getHookSubscriberBundles()); HookUtil::registerProviderBundles($this->version->getHookProviderBundles()); case '3.1.0': ModUtil::setVar('Quotes', 'enablefacebookshare', false); case '3.1.1': // future upgrade routines } // upgrade success return true; }
/** * Update the IWforms module * @author Albert Pérez Monfort (aperezm@xtec.cat) * @author Jaume Fernàndez Valiente (jfern343@xtec.cat) * @return bool true if successful, false otherwise */ public function upgrade($oldversion) { switch ($oldversion) { case ($oldversion < '3.0.0'): //ADD new fields to tables $c1 = "ALTER TABLE `IWforms_definition` ADD `iw_returnURL` VARCHAR (150) NOT NULL"; if (!DBUtil::executeSQL($c1)) { return false; } $c2 = "ALTER TABLE `IWforms_definition` ADD `iw_filesFolder` VARCHAR (25) NOT NULL"; if (!DBUtil::executeSQL($c2)) { return false; } $c3 = "ALTER TABLE `IWforms_definition` ADD `iw_lang` VARCHAR (2) NOT NULL DEFAULT ''"; if (!DBUtil::executeSQL($c3)) { return false; } // Update z_blocs table $c4 = "UPDATE blocks SET bkey = 'Formnote' WHERE bkey = 'formnote'"; if (!DBUtil::executeSQL($c4)) { return false; } $c5 = "UPDATE blocks SET bkey = 'Formslist' WHERE bkey = 'formslist'"; if (!DBUtil::executeSQL($c5)) { return false; } // serialize bloc Formslist content $where = "bkey='Formslist'"; $items = DBUtil::selectObjectArray('blocks', $where, '', '-1', '-1'); foreach ($items as $item) { $valuesArray = explode('---', $item['url']); $categories = $valuesArray[0]; $listBox = $valuesArray[1]; $serialized = serialize(array('categories' => $categories, 'listBox' => $listBox)); $c = "UPDATE blocks SET content = '$serialized', url='' WHERE bid = $item[bid]"; if (!DBUtil::executeSQL($c)) { return false; } } //Array de noms $oldVarsNames = DBUtil::selectFieldArray("module_vars", 'name', "`modname` = 'IWforms'", '', false, ''); $newVarsNames = Array('characters', 'resumeview', 'newsColor', 'viewedColor', 'completedColor', 'validatedColor', 'fieldsColor', 'contentColor', 'attached', 'publicFolder'); $newVars = Array('characters' => '15', 'resumeview' => '0', 'newsColor' => '#90EE90', 'viewedColor' => '#FFFFFF', 'completedColor' => '#D3D3D3', 'validatedColor' => '#CC9999', 'fieldsColor' => '#ADD8E6', 'contentColor' => '#FFFFE0', 'attached' => 'forms', 'publicFolder' => 'forms/public'); // Delete unneeded vars $del = array_diff($oldVarsNames, $newVarsNames); foreach ($del as $i) { $this->delVar($i); } // Add new vars $add = array_diff($newVarsNames, $oldVarsNames); foreach ($add as $i) { $this->setVar($i, $newVars[$i]); } case '3.0.0': DBUtil::changeTable('IWforms_definition'); case '3.0.1': //Implement Scribite Hooks HookUtil::registerSubscriberBundles($this->version->getHookSubscriberBundles()); //Templates to tpl $commands = array(); $commands[] ="ALTER TABLE IWforms_definition ALTER COLUMN iw_skinFormTemplate SET DEFAULT 'IWforms_user_new.tpl'"; $commands[] ="ALTER TABLE IWforms_definition ALTER COLUMN iw_skinTemplate SET DEFAULT 'IWforms_user_read.tpl'"; $commands[] ="ALTER TABLE IWforms_definition ALTER COLUMN iw_skinNoteTemplate SET DEFAULT 'IWforms_user_read.tpl'"; // Load DB connection $dbEvent = new Zikula_Event('doctrine.init_connection'); $connection = $this->eventManager->notify($dbEvent)->getData(); foreach ($commands as $sql) { $stmt = $connection->prepare($sql); $stmt->execute(); } case '3.0.2': } return true; }
/** * Update the IWqv module * @author Sara Arjona Téllez (sarjona@xtec.cat) * @return bool true if successful, false otherwise */ public function upgrade($oldversion) { if (!DBUtil::changeTable('IWqv')) return false; return true; }
$GLOBALS['ZConfig']['System']['Z_CONFIG_USE_OBJECT_ATTRIBUTION'] = false; $GLOBALS['ZConfig']['System']['Z_CONFIG_USE_OBJECT_LOGGING'] = false; $GLOBALS['ZConfig']['System']['Z_CONFIG_USE_OBJECT_META'] = false; // Lazy load DB connection to avoid testing DSNs that are not yet valid (e.g. no DB created yet) $dbEvent = new Zikula_Event('doctrine.init_connection', null, array('lazy' => true)); $connection = $eventManager->notify($dbEvent)->getData(); $columns = upgrade_getColumnsForTable($connection, 'modules'); if (in_array('pn_id', array_keys($columns))) { upgrade_columns($connection); } if (!isset($columns['capabilities'])) { Doctrine_Core::createTablesFromArray(array('Zikula_Doctrine_Model_HookArea', 'Zikula_Doctrine_Model_HookProvider', 'Zikula_Doctrine_Model_HookSubscriber', 'Zikula_Doctrine_Model_HookBinding', 'Zikula_Doctrine_Model_HookRuntime')); ModUtil::dbInfoLoad('Extensions', 'Extensions', true); DBUtil::changeTable('modules'); ModUtil::dbInfoLoad('Blocks', 'Blocks', true); DBUtil::changeTable('blocks'); } $installedVersion = upgrade_getCurrentInstalledCoreVersion($connection); if (version_compare($installedVersion, '1.3.0-dev') === -1) { $GLOBALS['_ZikulaUpgrader']['_ZikulaUpgradeFrom12x'] = true; } $core->init(Zikula_Core::STAGE_ALL); $action = FormUtil::getPassedValue('action', false, 'GETPOST'); // login to supplied admin credentials for action the following actions if ($action === 'upgrademodules' || $action === 'convertdb' || $action === 'sanitycheck') { $username = FormUtil::getPassedValue('username', null, 'POST'); $password = FormUtil::getPassedValue('password', null, 'POST'); $authenticationInfo = array('login_id' => $username, 'pass' => $password); $authenticationMethod = array('modname' => 'Users', 'method' => 'uname'); if (!UserUtil::loginUsing($authenticationMethod, $authenticationInfo)) { // force action to login
protected function contentUpgrade_4_1_1($oldVersion) { // update the database DBUtil::changeTable('content_page'); return true; }
public function upgrade($oldversion) { $dom = ZLanguage::getModuleDomain('IWbooks'); switch ($oldversion) { case 0.8: $dbconn = & DBConnectionStack::getConnection(true); $pntable = & DBUtil::getTables(); $llibrestable = $pntable['llibres']; $llibrescolumn = &$pntable['llibres_column']; $sql = "ALTER TABLE $llibrestable CHANGE $llibrescolumn[etapa] $llibrescolumn[etapa] varchar(32) NOT NULL default ''"; $dbconn->Execute($sql); $sql = "ALTER TABLE $llibrestable DROP pn_tipus"; $dbconn->Execute($sql); if ($dbconn->ErrorNo() != 0) { SessionUtil::setVar('errormsg', __('Failed to update the tables', $dom)); return false; } ModUtil::setVar('IWbooks', 'plans', ' PRI#Educació Primària| ESO#Educació Secundària Obligatòria| BTE#Batxillerat Tecnològic| BSO#Batxillerat Social| BHU#Batxillerat Humanístic| BCI#Batxillerat Científic| BAR#Batxillerat Artístic'); ModUtil::setVar('IWbooks', 'darrer_nivell', '4'); return IWbooks_upgrade(0.9); case 0.9: // Codi per a versió 1.0 $dbconn = & DBConnectionStack::getConnection(true); $pntable = & DBUtil::getTables(); $llibrestable = $pntable['llibres']; $llibrescolumn = &$pntable['llibres_column']; $sql = "ALTER TABLE $llibrestable ADD pn_observacions varchar(100) NOT NULL, ADD pn_materials text NOT NULL"; $dbconn->Execute($sql); if ($dbconn->ErrorNo() != 0) { SessionUtil::setVar('errormsg', $llibrestable . $oldversion . __('Failed to update the tables', $dom)); return false; } ModUtil::setVar('IWbooks', 'llistar_materials', '1'); ModUtil::setVar('IWbooks', 'mida_font', '11'); ModUtil::setVar('IWbooks', 'marca_aigua', '0'); return IWbooks_upgrade(1.0); case 1.0: // Codi per a versió 2.0 ModUtil::delVar('IWbooks', 'darrer_nivell'); ModUtil::setVar('IWbooks', 'nivells', ' 1#1r| 2#2n| 3#3r| 4#4t| 5#5è| 6#6è| A#P3| B#P4| C#P5'); if (!DBUtil::changeTable('IWbooks')) { return false; } if (!DBUtil::changeTable('IWbooks_materies')) { return false; } return IWbooks_upgrade(2.0); break; } // Actualització amb èxit return true; }
protected function contentUpgrade_4_1_1($oldVersion) { // update the database DBUtil::changeTable('content_page'); ModUtil::apiFunc('view', 'user', 'clear_compiled'); ModUtil::apiFunc('view', 'user', 'clear_cache', array('module' => 'Content')); return true; }
/** * Update the IWmenu module * @author Albert Perez Monfort (aperezm@xtec.cat) * @return bool true if successful, false otherwise */ public function upgrade($oldversion) { DBUtil::changeTable('IWmenu'); switch ($oldversion) { case '3.0.0': // add language features // get current lang code $currentLang = ZLanguage::getLanguageCode(); // get current items $items = DBUtil::selectObjectArray('IWmenu', '', ''); // get installed languages $languages = ZLanguage::getInstalledLanguages(); // update items with languages array $table = DBUtil::getTables(); $c = $table['IWmenu_column']; foreach ($items as $item) { $langArray = array(); $langText = ''; foreach ($languages as $lang) { $langArray[$lang] = ($lang == $currentLang) ? $item['text'] : ''; } $langText = serialize($langArray); // update text value with the serialised array $i = array('text' => $langText); $where = "$c[mid] = $item[mid]"; DBUtil::updateObject($i, 'IWmenu', $where); } case '3.0.1': // add language features for url fields // get current lang code $currentLang = ZLanguage::getLanguageCode(); // get current items $items = DBUtil::selectObjectArray('IWmenu', '', ''); // get installed languages $languages = ZLanguage::getInstalledLanguages(); // update items with languages array $table = DBUtil::getTables(); $c = $table['IWmenu_column']; foreach ($items as $item) { $langArray = array(); $langText = ''; foreach ($languages as $lang) { $langArray[$lang] = ($lang == $currentLang) ? $item['url'] : ''; } $langText = serialize($langArray); // update text value with the serialised array $i = array('url' => $langText); $where = "$c[mid] = $item[mid]"; DBUtil::updateObject($i, 'IWmenu', $where); } case '3.0.2': // future version } return true; }
/** * upgrade the SecurityCenter module from an old version * * @param string $oldVersion version number string to upgrade from * @return mixed true on success, last valid version string or false if fails */ public function upgrade($oldversion) { switch ($oldversion) { case '1.3': // create cache directory for HTML Purifier $purifierCacheDir = CacheUtil::getLocalDir() . '/purifierCache'; if (!file_exists($purifierCacheDir)) { CacheUtil::clearLocalDir('purifierCache'); } // create ids intrusions table if (!DBUtil::createTable('sc_intrusion')) { return false; } // create vars for phpids usage System::setVar('useids', 0); System::setVar('idsmail', 0); System::setVar('idsrulepath', 'config/phpids_zikula_default.xml'); System::setVar('idssoftblock', 1); // do not block requests, but warn for debugging System::setVar('idsfilter', 'xml'); // filter type System::setVar('idsimpactthresholdone', 1); // db logging System::setVar('idsimpactthresholdtwo', 10); // mail admin System::setVar('idsimpactthresholdthree', 25); // block request System::setVar('idsimpactthresholdfour', 75); // kick user, destroy session System::setVar('idsimpactmode', 1); // per request per default System::setVar('idshtmlfields', array('POST.__wysiwyg')); System::setVar('idsjsonfields', array('POST.__jsondata')); // Location of HTML Purifier System::setVar('idsrulepath', 'config/phpids_zikula_default.xml'); System::setVar('idsexceptions', array('GET.__utmz', 'GET.__utmc', 'REQUEST.linksorder', 'POST.linksorder', 'REQUEST.fullcontent', 'POST.fullcontent', 'REQUEST.summarycontent', 'POST.summarycontent', 'REQUEST.filter.page', 'POST.filter.page', 'REQUEST.filter.value', 'POST.filter.value')); System::delVar('htmlpurifierConfig'); // HTML Purifier default settings $purifierDefaultConfig = SecurityCenter_Util::getpurifierconfig(array('forcedefault' => true)); $this->setVar('htmlpurifierConfig', serialize($purifierDefaultConfig)); if (!DBUtil::changeTable('sc_intrusion')) { return false; } System::setVar('sessioncsrftokenonetime', 0); case '1.4.4': // future upgrade routines } // Update successful return true; }
/** * Migrate from version 1.13 to 2.2.0 * * @param string $oldversion The old version from which this upgrade is being processed. * * @return bool True on success; otherwise false. */ public function upgrade113XTablesTo220Tables($oldversion) { if (!DBUtil::changeTable('users_temp')) { return false; } // Get the dbinfo for the new version ModUtil::dbInfoLoad('Users', 'Users'); $nowUTC = new DateTime(null, new DateTimeZone('UTC')); $nowUTCStr = $nowUTC->format(Users_Constant::DATETIME_FORMAT); $serviceManager = ServiceUtil::getManager(); $dbinfoSystem = $serviceManager['dbtables']; $dbinfo113X = Users_tables('1.13'); $dbinfo220 = Users_tables('2.2.0'); $usersOldFields = array( 'user_theme', 'user_viewemail', 'storynum', 'counter', 'hash_method', 'validfrom', 'validuntil', ); $usersOldFieldsDB = array( $dbinfo113X['users_column']['user_theme'], $dbinfo113X['users_column']['user_viewemail'], $dbinfo113X['users_column']['storynum'], $dbinfo113X['users_column']['counter'], $dbinfo113X['users_column']['hash_method'], $dbinfo113X['users_column']['validfrom'], $dbinfo113X['users_column']['validuntil'] ); // Upgrade the tables // Update the users table with new and altered fields. No fields are removed at this point, and no fields // are getting a new data type that is incompatible, so no need to save anything off first. // Also, create the users_verifychg tables at this point. // Merge the global dbtables with the new field information. $tables['users_column'] = $dbinfo220['users_column']; $tables['users_column_def'] = $dbinfo220['users_column_def']; $tables['users_verifychg'] = $dbinfo220['users_verifychg']; $tables['users_verifychg_column'] = $dbinfo220['users_verifychg_column']; $tables['users_verifychg_column_def'] = $dbinfo220['users_verifychg_column_def']; $serviceManager['dbtables'] = array_merge($dbinfoSystem, $tables); // Now change the tables if (!DBUtil::changeTable('users')) { return false; } if (!DBUtil::createTable('users_verifychg')) { return false; } // First users_temp pending email verification records to users_verifychg. $tempColumn = $dbinfo113X['users_temp_column']; $verifyColumn = $dbinfo220['users_verifychg_column']; $usersColumn = $dbinfo220['users_column']; $legalModInfo = ModUtil::getInfoFromName('Legal'); if (($legalModInfo['state'] == ModUtil::STATE_ACTIVE) || ($legalModInfo['state'] == ModUtil::STATE_UPGRADED)) { $legalModuleActive = true; $termsOfUseActive = ModUtil::getVar('Legal', 'termsofuse', false); $privacyPolicyActive = ModUtil::getVar('Legal', 'privacypolicy', false); $agePolicyActive = ($this->getVar('minage', 0) > 0); } else { $legalModuleActive = false; } // Next, users table conversion // We need to convert some information over from the old users table fields, so merge the old field list into // the new one. The order of array_merge parameters is important here! $tables = array('users_column' => array_merge($dbinfo113X['users_column'], $dbinfo220['users_column'])); $serviceManager['dbtables'] = array_merge($dbinfoSystem, $tables); // Do the conversion in PHP we use mb_strtolower, and even if MySQL had an equivalent, there is // no guarantee that another supported DB platform would. $limitNumRows = 100; $limitOffset = 0; $updated = true; $userCount = DBUtil::selectObjectCount('users'); while ($limitOffset < $userCount) { $userArray = DBUtil::selectObjectArray('users', "{$usersColumn['uid']} != 1", '', $limitOffset, $limitNumRows, '', null, null, array('uid', 'uname', 'email', 'pass', 'hash_method', 'user_regdate', 'lastlogin', 'approved_by', 'approved_date')); if (!empty($userArray) && is_array($userArray)) { foreach ($userArray as $key => $userObj) { // force user names and emails to lower case $userArray[$key]['uname'] = mb_strtolower($userArray[$key]['uname']); $userArray[$key]['email'] = mb_strtolower($userArray[$key]['email']); if ($userArray[$key]['user_regdate'] == '1970-01-01 00:00:00') { $userArray[$key]['user_regdate'] = $nowUTCStr; $userArray[$key]['approved_date'] = $nowUTCStr; } else { $userArray[$key]['approved_date'] = $userArray[$key]['user_regdate']; } $userArray[$key]['approved_by'] = 2; // merge hash method for salted passwords, leave salt blank if (!empty($userArray[$key]['pass']) && (strpos($userArray[$key]['pass'], '$$') === false)) { $userArray[$key]['pass'] = (isset($userArray[$key]['hash_method']) ? $userArray[$key]['hash_method'] : '1') . '$$' . $userArray[$key]['pass']; } // Save some disappearing fields as attributes, just in case someone actually used them for // something. But don't overwrite if there already if (!isset($userArray[$key]['__ATTRIBUTES__']) || !is_array($userArray[$key]['__ATTRIBUTES__'])) { $userArray[$key]['__ATTRIBUTES__'] = array(); } foreach ($usersOldFields as $fieldName) { if (($fieldName != 'hash_method') && isset($userArray[$key][$fieldName]) && !empty($userArray[$key][$fieldName]) && !isset($userArray[$key]['__ATTRIBUTES__'][$fieldName])) { $userArray[$key]['__ATTRIBUTES__'][$fieldName] = $userArray[$key][$fieldName]; } } if ($legalModuleActive && ($userArray[$key]['uid'] > 2)) { $userRegDateTime = new DateTime($userArray[$key]['user_regdate'], new DateTimeZone('UTC')); $policyDateTimeStr = $userRegDateTime->format(DATE_ISO8601); if ($termsOfUseActive) { $userArray[$key]['__ATTRIBUTES__']['_Legal_termsOfUseAccepted'] = $policyDateTimeStr; } if ($privacyPolicyActive) { $userArray[$key]['__ATTRIBUTES__']['_Legal_privacyPolicyAccepted'] = $policyDateTimeStr; } if ($agePolicyActive) { $userArray[$key]['__ATTRIBUTES__']['_Legal_agePolicyConfirmed'] = $policyDateTimeStr; } } } } if (!DBUtil::updateObjectArray($userArray, 'users', 'uid', false)) { $updated = false; break; } $limitOffset += $limitNumRows; } if (!$updated) { return false; } $obaColumn = $dbinfoSystem['objectdata_attributes_column']; $limitNumRows = 100; $limitOffset = 0; $updated = true; $userCount = DBUtil::selectObjectCount('users_temp'); // Pass through the users_temp table in chunks of 100 // * ensure unames and email addresses are lower case, while ($limitOffset < $userCount) { $userTempArray = DBUtil::selectObjectArray('users_temp', '', '', $limitOffset, $limitNumRows, '', null, null, array('tid', 'type', 'uname', 'email', 'pass', 'hash_method', 'dynamics', 'comment')); $userArray = array(); if (!empty($userTempArray) && is_array($userTempArray)) { foreach ($userTempArray as $key => $userTempOpj) { // type == 1: User registration pending approval (moderation) if ($userTempArray[$key]['type'] == 1) { $userObj = array(); // Ensure uname and email are lower case $userObj['uname'] = mb_strtolower($userTempArray[$key]['uname']); $userObj['email'] = mb_strtolower($userTempArray[$key]['email']); // Convert pass to salted pass with embedded hash method, leave salt blank $userObj['pass'] = $userTempArray[$key]['hash_method'] . '$$' . $userTempArray[$key]['pass']; $userObj['approved_by'] = 0; $userObj['activated'] = Users_Constant::ACTIVATED_PENDING_REG; if (!empty($userTempArray[$key]['dynamics'])) { $userObj['__ATTRIBUTES__'] = unserialize($userTempArray[$key]['dynamics']); } else { $userObj['__ATTRIBUTES__'] = array(); } if (isset($userObj['dynamics']) && !empty($userObj['dynamics'])) { if (DataUtil::is_serialized($userObj['dynamics'])) { $dynamics = @unserialize($userObj['dynamics']); if (!empty($dynamics) && is_array($dynamics)) { foreach ($dynamics as $key => $value) { $userObj['__ATTRIBUTES__'][$key] = $value; } } } } $userObj['__ATTRIBUTES__']['_Users_isVerified'] = 0; if ($legalModuleActive) { $userRegDateTime = new DateTime($userArray[$key]['user_regdate'], new DateTimeZone('UTC')); $policyDateTimeStr = $userRegDateTime->format(DATE_ISO8601); if ($termsOfUseActive) { $userObj['__ATTRIBUTES__']['_Legal_termsOfUseAccepted'] = $policyDateTimeStr; } if ($privacyPolicyActive) { $userObj['__ATTRIBUTES__']['_Legal_privacyPolicyAccepted'] = $policyDateTimeStr; } if ($agePolicyActive) { $userObj['__ATTRIBUTES__']['_Legal_agePolicyConfirmed'] = $policyDateTimeStr; } } $userArray[] = $userObj; } else { throw new Zikula_Exception_Fatal($this->__f('Unknown users_temp record type: %1$s', array($userTempArray[$key]['type']))); } } } if (!DBUtil::insertObjectArray($userArray, 'users', 'uid', false)) { $updated = false; break; } $limitOffset += $limitNumRows; } if (!$updated) { return false; } // Done upgrading. Let's lose some old fields and tables we no longer need. DBUtil::dropColumn('users', $usersOldFieldsDB); DBUtil::dropTable('users_temp'); // Reset the system tables to the new table definitons, so the rest of the // system upgrade goes smoothly. $dbinfoSystem = $serviceManager['dbtables']; foreach ($dbinfo113X as $key => $value) { unset($dbinfoSystem[$key]); } foreach ($dbinfo220 as $key => $value) { $dbinfoSystem[$key] = $value; } $serviceManager['dbtables'] = $dbinfoSystem; // Update users table for data type change of activated field. if (!DBUtil::changeTable('users')) { return false; } return true; }
/** * upgrade the theme module from an old version * * This function must consider all the released versions of the module! * If the upgrade fails at some point, it returns the last upgraded version. * * @param string $oldVersion version number string to upgrade from * @return mixed true on success, last valid version string or false if fails */ public function upgrade($oldversion) { // update the table if (!DBUtil::changeTable('themes')) { return false; } switch ($oldversion) { case '3.1': $this->setVar('cssjscombine', false); $this->setVar('cssjscompress', false); $this->setVar('cssjsminify', false); $this->setVar('cssjscombine_lifetime', 3600); case '3.3': // convert pnRender modvars $pnrendervars = ModUtil::getVar('pnRender'); foreach ($pnrendervars as $k => $v) { $this->setVar('render_' . $k, $v); } // delete pnRender modvars ModUtil::delVar('pnRender'); $modid = ModUtil::getIdFromName('pnRender'); // check and update blocks $blocks = ModUtil::apiFunc('Blocks', 'user', 'getall', array('modid' => $modid)); if (!empty($blocks)) { $thememodid = ModUtil::getIdFromName('Theme'); foreach ($blocks as $block) { $block->setBkey('render'); $block->setMid($thememodid); $this->entityManager->flush(); } } // check and fix permissions $dbtable = DBUtil::getTables(); $permscolumn = $dbtable['group_perms_column']; $permswhere = "WHERE $permscolumn[component] = 'pnRender:pnRenderblock:'"; $perms = DBUtil::selectObjectArray('group_perms', $permswhere); if (!empty($perms)) { foreach ($perms as $perm) { $perm['component'] = 'Theme:Renderblock:'; DBUtil::updateObject($perm, 'group_perms', '', 'pid'); } } // Set Module pnRender 'Inactive' if (!ModUtil::apiFunc('Extensions', 'admin', 'setstate', array( 'id' => $modid, 'state' => ModUtil::STATE_INACTIVE))) { return '3.3'; } // Remove Module pnRender from Modulelist if (!ModUtil::apiFunc('Extensions', 'admin', 'remove', array( 'id' => $modid))) { return '3.3'; } case '3.4': if (!DBUtil::changeTable('themes')) { return '3.4'; } case '3.4.1': if (!DBUtil::changeTable('themes')) { return '3.4.1'; } $this->setVar('enable_mobile_theme', false); case '3.4.2': // future upgrade } // Update successful return true; }
/** * Update the IWvhmenu module * @author Albert Pï¿œrez Monfort (aperezm@xtec.cat) * @return bool true if successful, false otherwise */ public function upgrade($oldversion) { if ($oldversion < 1.1) { if (!DBUtil::changeTable('IWvhmenu')) return false; //Create indexes $table = DBUtil::getTables(); $c = $table['IWvhmenu_column']; if (!DBUtil::createIndex($c['id_parent'], 'IWvhmenu', 'id_parent')) return false; } return true; }
/** * Upgrade the settings module from an old version. * * This function must consider all the released versions of the module! * If the upgrade fails at some point, it returns the last upgraded version. * * @param string $oldVersion version number string to upgrade from. * * @return boolean|string True on success, last valid version string or false if fails. */ public function upgrade($oldversion) { // always ensure that the version info is upgraded System::setVar('Version_Num', Zikula_Core::VERSION_NUM); System::setVar('Version_ID', Zikula_Core::VERSION_ID); System::setVar('Version_Sub', Zikula_Core::VERSION_SUB); // Upgrade dependent on old version number switch ($oldversion) { case '2.5': System::delVar('jsquicktags'); System::delVar('backend_title'); System::delVar('refereronprint'); System::delVar('storyorder'); System::delVar('backend_language'); System::delVar('site_logo'); case '2.6': System::setVar('updatelastchecked', 0); System::setVar('updatefrequency', 7); System::setVar('updatecheck', true); case '2.7': System::setVar('language_i18n', 'en'); System::setVar('language_bc', 1); System::setVar('languageurl', 0); System::setVar('ajaxtimeout', 5000); //! this is a comma-separated list of special characters to search for in permalinks System::setVar('permasearch', $this->$this->__('À,Á,Â,Ã,Å,à,á,â,ã,å,Ò,Ó,Ô,Õ,Ø,ò,ó,ô,õ,ø,È,É,Ê,Ë,è,é,ê,ë,Ç,ç,Ì,Í,Î,Ï,ì,í,î,ï,Ù,Ú,Û,ù,ú,û,ÿ,Ñ,ñ,ß,ä,Ä,ö,Ö,ü,Ü')); //! this is a comma-separated list of special characters to replace in permalinks System::setVar('permareplace', $this->$this->__('A,A,A,A,A,a,a,a,a,a,O,O,O,O,O,o,o,o,o,o,E,E,E,E,e,e,e,e,C,c,I,I,I,I,i,i,i,i,U,U,U,u,u,u,y,N,n,ss,ae,Ae,oe,Oe,ue,Ue')); case '2.8': System::delVar('dyn_keywords'); case '2.9': case '2.9.1': System::delVar('timezone_info'); case '2.9.2': $tables = DBUtil::getTables(); $modulesTable = $tables['modules']; $name = $tables['modules_column']['name']; $sql = "DELETE FROM $modulesTable WHERE $name = 'ObjectData' OR $name = 'Workflow'"; DBUtil::executeSQL($sql); case '2.9.3': // This may have been set by the Users module upgrade already, so only set it if it does not exist. $systemIdnSetting = System::getVar('idnnames', null); if (isset($systemIdnSetting)) { if (ModUtil::available('Users')) { $usersIdnSetting = ModUtil::getVar('Users', 'idnnames', null); } System::setVar('idnnames', isset($usersIdnSetting) ? (bool)$usersIdnSetting : true); } System::delVar('language_bc'); case '2.9.4': System::setVar('defaultpagetitle', $this->__('Site name')); System::setVar('defaultmetadescription', $this->__('Site description')); case '2.9.5': System::delVar('shorturlsext'); case '2.9.6': DBUtil::changeTable('objectdata_attributes'); // future upgrade routines } // Update successful return true; }
function upgrade($oldversion) { $prefix = System::getVar('prefix'); $prefix = $prefix ? $prefix . '_' : ''; switch ($oldversion) { case '1.0': $sql = "ALTER TABLE " . $prefix . "addressbook_address ADD adr_geodata VARCHAR( 180 ) NULL AFTER adr_country"; if (!DBUtil::executeSQL($sql, -1, -1, false, true)) { return false; } // Upgrade successfull ModUtil::setVar('Addressbook', 'google_api_key', ''); ModUtil::setVar('Addressbook', 'google_zoom', 15); return AddressBook_upgrade(1.1); case '1.1': $this->_addressbook_migratecategories(); $this->_addressbook_migrateprefixes(); ModUtil::delVar('Addressbook', 'name_order'); ModUtil::delVar('Addressbook', 'zipbeforecity'); return AddressBook_upgrade(1.2); case '1.2': ModUtil::delVar('Addressbook', 'textareawidth'); ModUtil::delVar('Addressbook', 'dateformat'); ModUtil::delVar('Addressbook', 'numformat'); $this->_addressbook_upgradeto_1_3(); return true; case '1.3': case '1.3.1': // drop table prefix if ($prefix) { $connection = Doctrine_Manager::getInstance()->getConnection('default'); $sqlStatements = array(); $sqlStatements[] = 'RENAME TABLE ' . $prefix . 'addressbook_address' . " TO `addressbook_address`"; $sqlStatements[] = 'RENAME TABLE ' . $prefix . 'addressbook_customfields' . " TO `addressbook_customfields`"; $sqlStatements[] = 'RENAME TABLE ' . $prefix . 'addressbook_favourites' . " TO `addressbook_favourites`"; $sqlStatements[] = 'RENAME TABLE ' . $prefix . 'addressbook_labels' . " TO `addressbook_labels`"; foreach ($sqlStatements as $sql) { $stmt = $connection->prepare($sql); try { $stmt->execute(); } catch (Exception $e) { } } } case '1.3.2': // Register hooks $connection = Doctrine_Manager::getInstance()->getConnection('default'); $sqlQueries = array(); $sqlQueries[] = 'DELETE FROM `hook_area` WHERE `owner`="AddressBook"'; $sqlQueries[] = 'DELETE FROM `hook_subscriber` WHERE `owner`="AddressBook"'; foreach ($sqlQueries as $sql) { $stmt = $connection->prepare($sql); try { $stmt->execute(); } catch (Exception $e) { } } HookUtil::registerSubscriberBundles($this->version->getHookSubscriberBundles()); case '1.3.3': // Register event handlers if (ModUtil::available('Content')) { Content_Installer::updateContentType('AddressBook'); } EventUtil::registerPersistentModuleHandler('AddressBook', 'module.content.gettypes', array('AddressBook_EventHandler_Listeners', 'getContentTypes')); // default images directory and manager $this->setVar('images_dir', 'userdata/Addressbook'); $this->setVar('images_manager', 'kcfinder'); case '1.3.4': // Add language and status column DBUtil::changeTable('addressbook_address'); // Assume language of created records is "All". Status set to active. $objArray = array('language' => '', 'status' => 1); DBUtil::updateObject($objArray, 'addressbook_address', 'WHERE 1'); // Delete unused settings ModUtil::delVar('Addressbook', 'special_chars_1'); ModUtil::delVar('Addressbook', 'special_chars_2'); // Register new settings $this->setVar('addressbooktype', 1); // 1-people, 2-companies $this->setVar('showabcfilter', 1); case '1.3.5': // Register new settings $this->setVar('allowprivate', 0); return true; case '1.3.6': return true; } }
/** * Upgrade ephemerides module * @author The Zikula Development Team * @return true if init successful, false otherwise */ public function upgrade($oldversion) { // upgrade dependent on old version number switch ($oldversion) { case '1.2': // version 1.2 shipped with postnuke .72x/.75 ModUtil::setVar('Ephemerides', 'itemsperpage', 25); case '1.6': $this->ephemerides_upgrade_updateEphemeridesLanguages(); case '1.7': // needs update of table, added status column // needs update of table, added status column case '1.8': // needs update of table, added type column // needs update of table, added type column case '1.9': $connection = Doctrine_Manager::getInstance()->getConnection('default'); // drop table prefix $prefix = $this->serviceManager['prefix']; $sqlQueries = array(); $sqlQueries[] = 'RENAME TABLE ' . $prefix . '_ephem' . " TO `ephem`"; $sqlQueries[] = "ALTER TABLE `ephem` CHANGE `pn_eid` `eid` INT(11) NOT NULL AUTO_INCREMENT"; $sqlQueries[] = "ALTER TABLE `ephem` CHANGE `pn_did` `did` TINYINT(4) NOT NULL DEFAULT '0'"; $sqlQueries[] = "ALTER TABLE `ephem` CHANGE `pn_mid` `mid` TINYINT(4) NOT NULL DEFAULT '0'"; $sqlQueries[] = "ALTER TABLE `ephem` CHANGE `pn_yid` `yid` SMALLINT(6) NOT NULL DEFAULT '0'"; $sqlQueries[] = "ALTER TABLE `ephem` CHANGE `pn_content` `content` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL"; $sqlQueries[] = "ALTER TABLE `ephem` CHANGE `pn_language` `language` VARCHAR(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT ''"; $sqlQueries[] = "ALTER TABLE `ephem` CHANGE `pn_obj_status` `obj_status` VARCHAR(1) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'A'"; $sqlQueries[] = "ALTER TABLE `ephem` CHANGE `pn_cr_date` `cr_date` DATETIME NOT NULL DEFAULT '1970-01-01 00:00:00'"; $sqlQueries[] = "ALTER TABLE `ephem` CHANGE `pn_cr_uid` `cr_uid` INT(11) NOT NULL DEFAULT '0'"; $sqlQueries[] = "ALTER TABLE `ephem` CHANGE `pn_lu_date` `lu_date` DATETIME NOT NULL DEFAULT '1970-01-01 00:00:00'"; $sqlQueries[] = "ALTER TABLE `ephem` CHANGE `pn_lu_uid` `lu_uid` INT(11) NOT NULL DEFAULT '0'"; $sqlQueries[] = "ALTER TABLE `ephem` CHANGE `pn_status` `status` TINYINT(4) NULL DEFAULT '1'"; $sqlQueries[] = "ALTER TABLE `ephem` CHANGE `pn_type` `type` TINYINT(4) NULL DEFAULT '1'"; foreach ($sqlQueries as $sql) { $stmt = $connection->prepare($sql); try { $stmt->execute(); } catch (Exception $e) { } } // update table structure according to table defenition if (!DBUtil::changeTable('ephem')) { return "1.9"; } // enable categorisation this module ModUtil::setVar('Ephemerides', 'enablecategorization', true); // create our default category if (!$this->_createdefaultcategory()) { LogUtil::registerStatus($this->{$this}->__('Warning! Could not create the default Ephemerides category tree. If you want to use categorisation with Ephemerides, register at least one property for the module in the Category Registry.')); $modvars['enablecategorization'] = false; } case '3.0.0': $connection = Doctrine_Manager::getInstance()->getConnection('default'); // Change module name from Ephemerids to Ephemerides $sqlQueries = array(); $sqlQueries[] = "UPDATE `modules` SET `name`='Ephemerides', `directory`='Ephemerides', `securityschema`='a:1:{s:13:\"Ephemerides::\";s:14:\"::Ephemerid ID\";}' WHERE `directory`='Ephemerids';"; $sqlQueries[] = "UPDATE `module_vars` SET `modname`='Ephemerides' WHERE `modname`='Ephemerids';"; foreach ($sqlQueries as $sql) { $stmt = $connection->prepare($sql); try { $stmt->execute(); } catch (Exception $e) { } } // Register hooks $sqlQueries = array(); $sqlQueries[] = 'DELETE FROM `hook_area` WHERE `owner`="Ephemerides"'; $sqlQueries[] = 'DELETE FROM `hook_subscriber` WHERE `owner`="Ephemerides"'; $sqlQueries[] = 'DELETE FROM `hook_provider` WHERE `owner`="Ephemerides"'; foreach ($sqlQueries as $sql) { $stmt = $connection->prepare($sql); try { $stmt->execute(); } catch (Exception $e) { } } HookUtil::registerSubscriberBundles($this->version->getHookSubscriberBundles()); HookUtil::registerProviderBundles($this->version->getHookProviderBundles()); case '3.1.0': ModUtil::setVar('Ephemerides', 'enablefacebookshare', false); case '3.1.1': // future upgrade routines } // upgrade success return true; }
/** * upgrade the News module from an old version * * @return bool true on success, false otherwise */ public function upgrade($oldversion) { // Upgrade dependent on old version number switch ($oldversion) { case '1.3': case '1.4': $this->setVar('storyhome', System::getVar('storyhome')); System::delVar('storyhome'); $this->setVar('storyorder', System::getVar('storyorder')); System::delVar('storyorder'); $this->setVar('itemsperpage', 25); case '1.5': $tables = DBUtil::getTables(); $shorturlsep = System::getVar('shorturlsseparator'); // move the data from the author uid to creator and updator uid $sqls = array(); $sqls[] = "UPDATE $tables[stories] SET pn_cr_uid = pn_aid"; $sqls[] = "UPDATE $tables[stories] SET pn_lu_uid = pn_aid"; // move the data from the time field to the creation and update datestamp $sqls[] = "UPDATE $tables[stories] SET pn_cr_date = pn_time"; $sqls[] = "UPDATE $tables[stories] SET pn_lu_date = pn_time"; $sqls[] = "UPDATE $tables[stories] SET pn_urltitle = REPLACE(pn_title, ' ', '{$shorturlsep}')"; foreach ($sqls as $sql) { if (!DBUtil::executeSQL($sql)) { LogUtil::registerError($this->__('Error! Could not update table.')); return '1.5'; } } // drop the old columns DBUtil::dropColumn('stories', array('pn_aid')); DBUtil::dropColumn('stories', array('pn_time')); $this->setVar('permalinkformat', '%year%/%monthnum%/%day%/%storytitle%'); case '2.0': // import autonews and queue articles if (!$this->_import_autonews_queue()) { LogUtil::registerError($this->__('Error! Could not update articles.')); return '2.0'; } // migrate the comments to ezcomments if (ModUtil::available('Comments') || defined('_PNINSTALLVER')) { // check for the ezcomments module if (!ModUtil::available('EZComments')) { LogUtil::registerError(__f('Error! The \'%s\' module is not installed.', 'EZComments')); return '2.0'; } // drop the comments table if successful if (ModUtil::apiFunc('EZComments', 'migrate', 'news')) { // drop comments table after migration has succeeded if (!DBUtil::dropTable('comments')) { LogUtil::registerError($this->__('Error! Could not delete table.')); return '2.0'; } // remove the Comments module ModUtil::apiFunc('Modules', 'admin', 'remove', array('id' => ModUtil::getIdFromName('Comments'))); } } // drop the autonews and queue tables, articles are already imported if (!DBUtil::dropTable('autonews')) { LogUtil::registerError($this->__('Error! Could not delete table.')); return '2.0'; } if (!DBUtil::dropTable('queue')) { LogUtil::registerError($this->__('Error! Could not delete table.')); return '2.0'; } // remove the AddStory and Submit_News modules ModUtil::apiFunc('Modules', 'admin', 'remove', array('id' => ModUtil::getIdFromName('AddStory'))); ModUtil::apiFunc('Modules', 'admin', 'remove', array('id' => ModUtil::getIdFromName('Submit_News'))); case '2.1': $this->setVar('enablecategorization', true); ModUtil::dbInfoLoad('News', 'News', true); if (!$this->_news_migratecategories()) { LogUtil::registerError($this->__('Error! Could not migrate categories.')); return '2.1'; } case '2.2': $this->setVar('refereronprint', System::getVar('refereronprint', 0)); case '2.3': $prefix = System::getVar('prefix'); // when from is not set, put it to the creation date $sqls = array(); $sqls[] = "UPDATE {$prefix}_stories SET pn_from = pn_cr_date WHERE pn_from IS NULL"; // make sure we dont have an NULL hometext, since the tables permitted this before 2.4 $sqls[] = "UPDATE {$prefix}_stories SET pn_hometext = '' WHERE pn_hometext IS NULL"; foreach ($sqls as $sql) { if (!DBUtil::executeSQL($sql)) { LogUtil::registerError($this->__('Error! Could not update table.')); return '2.3'; } } $this->setVar('enableattribution', false); // import the topicimagepath, variable tipath deletion is up to Topics module $this->setVar('catimagepath', System::getVar('tipath')); $this->setVar('enableajaxedit', false); // drop old legacy columns DBUtil::dropColumn('stories', 'pn_comments'); DBUtil::dropColumn('stories', 'pn_themeoverride'); // clear compiled templates and News cache (see #74) ModUtil::apiFunc('view', 'user', 'clear_compiled'); ModUtil::apiFunc('view', 'user', 'clear_cache', array('module' => 'News')); case '2.4': case '2.4.1': // rename the database table from stories to news if (!DBUtil::renameTable('stories', 'news')) { LogUtil::registerError($this->__('Error! Could not rename table.')); return '2.4.1'; } case '2.4.2': // rename several columns, tables holds the old names for backwards compatibility still $columns = array_keys(DBUtil::metaColumns('news', true)); if (in_array('PN_WITHCOMM', $columns) && !DBUtil::renameColumn('news', 'pn_withcomm', 'disallowcomments')) { LogUtil::registerError($this->__('Error! Could not rename column.')); return '2.4.2'; } if (in_array('PN_INFORMANT', $columns) && !DBUtil::renameColumn('news', 'pn_informant', 'contributor')) { LogUtil::registerError($this->__('Error! Could not rename column.')); return '2.4.2'; } if (in_array('PN_IHOME', $columns) && !DBUtil::renameColumn('news', 'pn_ihome', 'hideonindex')) { LogUtil::registerError($this->__('Error! Could not rename column.')); return '2.4.2'; } case '2.4.3': // update table for missing fields etc if (!DBUtil::changeTable('news')) { return '2.4.3'; } // update permissions with new scheme News:: ModUtil::dbInfoLoad('Categories'); $tables = DBUtil::getTables(); $grperms = $tables['group_perms_column']; $sqls = array(); $sqls[] = "UPDATE $tables[group_perms] SET $grperms[component] = 'News::' WHERE $grperms[component] = 'Stories::Story'"; // update categories_mapobj and categories_registry with new tablename (categories tables not in $tables ?) $sqls[] = "UPDATE $tables[categories_mapobj] SET cmo_table='news' WHERE cmo_table='stories'"; $sqls[] = "UPDATE $tables[categories_registry] SET crg_table='news' WHERE crg_table='stories'"; foreach ($sqls as $sql) { if (!DBUtil::executeSQL($sql)) { LogUtil::registerError($this->__('Error! Could not update table.')); return '2.4.3'; } } // Add new variable(s) $this->setVar('enablemorearticlesincat', false); $this->setVar('morearticlesincat', 0); $this->setVar('notifyonpending', false); $this->setVar('notifyonpending_fromname', ''); $this->setVar('notifyonpending_fromaddress', ''); $this->setVar('notifyonpending_toname', ''); $this->setVar('notifyonpending_toaddress', ''); $this->setVar('notifyonpending_subject', $this->__('A News Publisher article has been submitted for review')); $this->setVar('notifyonpending_html', true); $this->setVar('pdflink', false); $this->setVar('pdflink_tcpdfpath', 'config/classes/tcpdf/tcpdf.php'); $this->setVar('pdflink_tcpdflang', 'config/classes/tcpdf/config/lang/eng.php'); $this->setVar('pdflink_headerlogo', 'tcpdf_logo.jpg'); $this->setVar('pdflink_headerlogo_width', '30'); // clear compiled templates and News cache ModUtil::apiFunc('view', 'user', 'clear_compiled'); ModUtil::apiFunc('view', 'user', 'clear_cache', array('module' => 'News')); case '2.5': // update table if (!DBUtil::changeTable('news')) { return '2.5'; } case '2.5.1': case '2.5.2': // add the new picture column and update the table if (!DBUtil::changeTable('news')) { return '2.5.2'; } // add new picture uploading variables $this->setVar('picupload_enabled', false); $this->setVar('picupload_allowext', 'jpg, gif, png'); $this->setVar('picupload_index_float', 'left'); $this->setVar('picupload_article_float', 'left'); $this->setVar('picupload_maxfilesize', '500000'); $this->setVar('picupload_maxpictures', '3'); $this->setVar('picupload_sizing', '0'); $this->setVar('picupload_picmaxwidth', '600'); $this->setVar('picupload_picmaxheight', '600'); $this->setVar('picupload_thumbmaxwidth', '150'); $this->setVar('picupload_thumbmaxheight', '150'); $this->setVar('picupload_thumb2maxwidth', '200'); $this->setVar('picupload_thumb2maxheight', '200'); $this->setVar('picupload_uploaddir', 'images/news_picupload'); // add new category parameter $this->setVar('enablecategorybasedpermissions', true); // permalink format change story to article $this->setVar('permalinkformat', str_replace(array('storytitle', 'storyid'), array('articletitle', 'articleid'), $this->getVar('permalinkformat'))); // clear compiled templates and News cache ModUtil::apiFunc('view', 'user', 'clear_compiled'); ModUtil::apiFunc('view', 'user', 'clear_cache', array('module' => 'News')); case '2.6.0': case '2.6.1': $this->setVar('enabledescriptionvar', false); $this->setVar('descriptionvarchars', 250); case '2.6.2': case '2.6.3': // register handlers EventUtil::registerPersistentModuleHandler('News', 'get.pending_content', array('News_Handlers', 'pendingContent')); EventUtil::registerPersistentModuleHandler('News', 'module.content.gettypes', array('News_Handlers', 'getTypes')); $prefix = $this->serviceManager['prefix']; $connection = Doctrine_Manager::getInstance()->getConnection('default'); $sqlStatements = array(); // N.B. statements generated with PHPMyAdmin $sqlStatements[] = 'RENAME TABLE ' . $prefix . '_news' . " TO `news`"; // this removes the prefixes but also changes hideonindex to displayonindex and disallowcomments to allowcomments // because 'from' and 'to' are reserved sql words, the column names are changed to ffrom and tto respectively $sqlStatements[] = "ALTER TABLE `news` CHANGE `pn_sid` `sid` INT( 11 ) NOT NULL AUTO_INCREMENT , CHANGE `pn_title` `title` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL , CHANGE `pn_hometext` `hometext` LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL , CHANGE `pn_bodytext` `bodytext` LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL , CHANGE `pn_counter` `counter` INT( 11 ) NULL DEFAULT '0', CHANGE `pn_contributor` `contributor` VARCHAR( 25 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL , CHANGE `pn_notes` `notes` LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL , CHANGE `pn_hideonindex` `displayonindex` TINYINT( 4 ) NOT NULL DEFAULT '0', CHANGE `pn_language` `language` VARCHAR( 30 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL , CHANGE `pn_disallowcomments` `allowcomments` TINYINT( 4 ) NOT NULL DEFAULT '0' , CHANGE `pn_format_type` `format_type` TINYINT( 4 ) NOT NULL DEFAULT '0', CHANGE `pn_urltitle` `urltitle` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL , CHANGE `pn_published_status` `published_status` TINYINT( 4 ) NULL DEFAULT '0', CHANGE `pn_from` `ffrom` DATETIME NULL DEFAULT NULL , CHANGE `pn_to` `tto` DATETIME NULL DEFAULT NULL , CHANGE `pn_obj_status` `obj_status` VARCHAR( 1 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'A', CHANGE `pn_cr_date` `cr_date` DATETIME NOT NULL DEFAULT '1970-01-01 00:00:00' , CHANGE `pn_cr_uid` `cr_uid` INT( 11 ) NOT NULL DEFAULT '0', CHANGE `pn_lu_date` `lu_date` DATETIME NOT NULL DEFAULT '1970-01-01 00:00:00', CHANGE `pn_lu_uid` `lu_uid` INT( 11 ) NOT NULL DEFAULT '0', CHANGE `pn_approver` `approver` INT( 11 ) NULL DEFAULT '0', CHANGE `pn_weight` `weight` TINYINT( 4 ) NULL DEFAULT '0', CHANGE `pn_pictures` `pictures` INT( 11 ) NULL DEFAULT '0'"; foreach ($sqlStatements as $sql) { $stmt = $connection->prepare($sql); try { $stmt->execute(); } catch (Exception $e) { } } if (!DBUtil::changeTable('news')) { return '2.6.3'; } HookUtil::registerSubscriberBundles($this->version->getHookSubscriberBundles()); $this->delVar('pdflink_tcpdfpath'); $this->delVar('pdflink_tcpdflang'); $this->setVar('itemsperadminpage', 15); $this->setVar('pdflink_enablecache', true); // enable variable for old shorturl scheme (display and main func not shown) $this->setVar('shorturls26x', true); if (ModUtil::available('Content')) { Content_Installer::updateContentType('News'); } $this->_invertHideAndComments(); $this->fixStartSettings(); case '3.0.0': // nothing to do case '3.0.1': // future plans } // Update successful return true; }