当前位置: 首页>>代码示例>>PHP>>正文


PHP DBUtil::changeTable方法代码示例

本文整理汇总了PHP中DBUtil::changeTable方法的典型用法代码示例。如果您正苦于以下问题:PHP DBUtil::changeTable方法的具体用法?PHP DBUtil::changeTable怎么用?PHP DBUtil::changeTable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DBUtil的用法示例。


在下文中一共展示了DBUtil::changeTable方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Upgrade

    /**
     * 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;
    }
开发者ID:projectesIF,项目名称:Sirius,代码行数:31,代码来源:Installer.php

示例2: upgrade

 /**
  * 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;
 }
开发者ID:planetenkiller,项目名称:core,代码行数:43,代码来源:Installer.php

示例3: upgrade

    /**
     * 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;
    }
开发者ID:projectesIF,项目名称:Sirius,代码行数:51,代码来源:Installer.php

示例4: upgrade

    /**
     * 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;
    }
开发者ID:projectesIF,项目名称:Sirius,代码行数:51,代码来源:Installer.php

示例5: upgrade

    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;
    }
开发者ID:projectesIF,项目名称:Sirius,代码行数:49,代码来源:Installer.php

示例6: mediashare_upgrade_to_3_4_1

function mediashare_upgrade_to_3_4_1()
{
    if (!DBUtil::changeTable('mediashare_mediastore')) {
        return false;
    }
    return true;
}
开发者ID:ro0f,项目名称:Mediashare,代码行数:7,代码来源:pninit.php

示例7: upgrade

 /**
  * 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;
 }
开发者ID:rmaiwald,项目名称:EZComments,代码行数:59,代码来源:Installer.php

示例8: upgrade

    /**
     * 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;
//.........这里部分代码省略.........
开发者ID:projectesIF,项目名称:Sirius,代码行数:101,代码来源:Installer.php

示例9: upgrade

    /**
     * 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';
                }
//.........这里部分代码省略.........
开发者ID:projectesIF,项目名称:Sirius,代码行数:101,代码来源:Installer.php

示例10: upgrade

 /**
  * 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;
 }
开发者ID:nmpetkov,项目名称:Quotes,代码行数:79,代码来源:Installer.php

示例11: upgrade

    /**
     * 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':
        }

//.........这里部分代码省略.........
开发者ID:projectesIF,项目名称:Sirius,代码行数:101,代码来源:Installer.php

示例12: upgrade

    /**
     * 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;
    }
开发者ID:projectesIF,项目名称:Sirius,代码行数:11,代码来源:Installer.php

示例13: Zikula_Event

$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
开发者ID:Git-Host,项目名称:AMPPS,代码行数:31,代码来源:orig_upgrade.php

示例14: contentUpgrade_4_1_1

 protected function contentUpgrade_4_1_1($oldVersion)
 {
     // update the database
     DBUtil::changeTable('content_page');
     return true;
 }
开发者ID:robbrandt,项目名称:Content,代码行数:6,代码来源:Installer.php

示例15: upgrade

    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;
    }
开发者ID:projectesIF,项目名称:Sirius,代码行数:88,代码来源:Installer.php


注:本文中的DBUtil::changeTable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。