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


PHP EventUtil::registerPersistentModuleHandler方法代码示例

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


在下文中一共展示了EventUtil::registerPersistentModuleHandler方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: install

 /**
  * @return bool
  */
 public function install()
 {
     try {
         DoctrineHelper::createSchema($this->entityManager, array('Dashboard_Entity_Widget', 'Dashboard_Entity_UserWidget'));
     } catch (Exception $e) {
         return false;
     }
     $this->setVar('widgets_per_row', 5);
     $this->setVar('available_per_row', 5);
     $this->setVar('new_user', 1);
     EventUtil::registerPersistentModuleHandler($this->name, 'installer.module.uninstalled', array('Dashboard_Listener_UninstallListener', 'onUninstallModule'));
     EventUtil::registerPersistentModuleHandler($this->name, 'user.account.create', array('Dashboard_Listener_CreateUserListener', 'onCreateUser'));
     EventUtil::registerPersistentModuleHandler($this->name, 'user.account.delete', array('Dashboard_Listener_RemoveUserListener', 'onRemoveUser'));
     return true;
 }
开发者ID:robbrandt,项目名称:Dashboard,代码行数:18,代码来源:Installer.php

示例3: Install

    /**
     * initialise the module
     *
     * @author Francesc Bassas i Bullich
     * @return bool true on success, false otherwise
     */
    public function Install() {

        // Set default module variables
        $this->setVar('enabled', 0)
                ->setVar('idApp', 'SIRIUS')
                ->setVar('replyAddress', System::getVar('adminmail'))
                ->setVar('sender', 'educacio')
                ->setVar('environment', 'PRO') // Referent a l'entorn (INT, ACC, PRO, FRM)
                ->setVar('contenttype', 2)
                ->setVar('log', 0)
                ->setVar('debug', 0)
                ->setVar('logpath', '');

        EventUtil::registerPersistentModuleHandler('SiriusXtecMailer', 'module.mailer.api.sendmessage', array('SiriusXtecMailer_Listeners', 'sendMail'));

        // Initialisation successful
        return true;
    }
开发者ID:projectesIF,项目名称:Sirius,代码行数:24,代码来源:Installer.php

示例4: upgrade

    public function upgrade($oldversion)
    {
        switch ($oldVersion) {
            case '1.0.0':
                EventUtil::registerPersistentModuleHandler('SiriusXtecAuth', 'module.users.ui.logout.succeeded', array('SiriusXtecAuth_Listeners', 'logoutXtecApps'));
                $this->setVars(array('loginXtecApps' => false,
                                    'logoutXtecApps' => false,
                                    'gtafURL' => 'aplitic.xtec.cat/pls/gafoas/pk_for_mod_menu.p_for_opcions_menu?p_perfil=RES',
                                    'e13URL' => 'aplitic.xtec.cat/pls/e13_formacio_gaf/formacio_gaf.inici',
									'loginTime' => 200,
							 		'logoutTime' => 200));
            case '1.0.1':
                $this->setVars(array('gtafProtocol' => 'http',
                                     'e13Protocol' => 'http'));
            case '1.0.2':
                //This is the current version. Here next changes will be added
        }        
        return true;
    }
开发者ID:projectesIF,项目名称:Sirius,代码行数:19,代码来源:Installer.php

示例5: 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

示例6: registerPersistentEventHandlers

 /**
  * Register persistent event handlers.
  * These are listeners for external events of the core and other modules.
  */
 protected function registerPersistentEventHandlers()
 {
     // core ->
     EventUtil::registerPersistentModuleHandler('Reviews', 'api.method_not_found', array('Reviews_Listener_Core', 'apiMethodNotFound'));
     EventUtil::registerPersistentModuleHandler('Reviews', 'core.preinit', array('Reviews_Listener_Core', 'preInit'));
     EventUtil::registerPersistentModuleHandler('Reviews', 'core.init', array('Reviews_Listener_Core', 'init'));
     EventUtil::registerPersistentModuleHandler('Reviews', 'core.postinit', array('Reviews_Listener_Core', 'postInit'));
     EventUtil::registerPersistentModuleHandler('Reviews', 'controller.method_not_found', array('Reviews_Listener_Core', 'controllerMethodNotFound'));
     // front controller -> Reviews_Listener_FrontController
     EventUtil::registerPersistentModuleHandler('Reviews', 'frontcontroller.predispatch', array('Reviews_Listener_FrontController', 'preDispatch'));
     // installer -> Reviews_Listener_Installer
     EventUtil::registerPersistentModuleHandler('Reviews', 'installer.module.installed', array('Reviews_Listener_Installer', 'moduleInstalled'));
     EventUtil::registerPersistentModuleHandler('Reviews', 'installer.module.upgraded', array('Reviews_Listener_Installer', 'moduleUpgraded'));
     EventUtil::registerPersistentModuleHandler('Reviews', 'installer.module.uninstalled', array('Reviews_Listener_Installer', 'moduleUninstalled'));
     EventUtil::registerPersistentModuleHandler('Reviews', 'installer.subscriberarea.uninstalled', array('Reviews_Listener_Installer', 'subscriberAreaUninstalled'));
     // modules -> Reviews_Listener_ModuleDispatch
     EventUtil::registerPersistentModuleHandler('Reviews', 'module_dispatch.postloadgeneric', array('Reviews_Listener_ModuleDispatch', 'postLoadGeneric'));
     EventUtil::registerPersistentModuleHandler('Reviews', 'module_dispatch.preexecute', array('Reviews_Listener_ModuleDispatch', 'preExecute'));
     EventUtil::registerPersistentModuleHandler('Reviews', 'module_dispatch.postexecute', array('Reviews_Listener_ModuleDispatch', 'postExecute'));
     EventUtil::registerPersistentModuleHandler('Reviews', 'module_dispatch.custom_classname', array('Reviews_Listener_ModuleDispatch', 'customClassname'));
     EventUtil::registerPersistentModuleHandler('Reviews', 'module_dispatch.service_links', array('Reviews_Listener_ModuleDispatch', 'serviceLinks'));
     // mailer -> Reviews_Listener_Mailer
     EventUtil::registerPersistentModuleHandler('Reviews', 'module.mailer.api.sendmessage', array('Reviews_Listener_Mailer', 'sendMessage'));
     // page -> Reviews_Listener_Page
     EventUtil::registerPersistentModuleHandler('Reviews', 'pageutil.addvar_filter', array('Reviews_Listener_Page', 'pageutilAddvarFilter'));
     EventUtil::registerPersistentModuleHandler('Reviews', 'system.outputfilter', array('Reviews_Listener_Page', 'systemOutputfilter'));
     // errors -> Reviews_Listener_Errors
     EventUtil::registerPersistentModuleHandler('Reviews', 'setup.errorreporting', array('Reviews_Listener_Errors', 'setupErrorReporting'));
     EventUtil::registerPersistentModuleHandler('Reviews', 'systemerror', array('Reviews_Listener_Errors', 'systemError'));
     // theme -> Reviews_Listener_Theme
     EventUtil::registerPersistentModuleHandler('Reviews', 'theme.preinit', array('Reviews_Listener_Theme', 'preInit'));
     EventUtil::registerPersistentModuleHandler('Reviews', 'theme.init', array('Reviews_Listener_Theme', 'init'));
     EventUtil::registerPersistentModuleHandler('Reviews', 'theme.load_config', array('Reviews_Listener_Theme', 'loadConfig'));
     EventUtil::registerPersistentModuleHandler('Reviews', 'theme.prefetch', array('Reviews_Listener_Theme', 'preFetch'));
     EventUtil::registerPersistentModuleHandler('Reviews', 'theme.postfetch', array('Reviews_Listener_Theme', 'postFetch'));
     // view -> Reviews_Listener_View
     EventUtil::registerPersistentModuleHandler('Reviews', 'view.init', array('Reviews_Listener_View', 'init'));
     EventUtil::registerPersistentModuleHandler('Reviews', 'view.postfetch', array('Reviews_Listener_View', 'postFetch'));
     // user login -> Reviews_Listener_UserLogin
     EventUtil::registerPersistentModuleHandler('Reviews', 'module.users.ui.login.started', array('Reviews_Listener_UserLogin', 'started'));
     EventUtil::registerPersistentModuleHandler('Reviews', 'module.users.ui.login.veto', array('Reviews_Listener_UserLogin', 'veto'));
     EventUtil::registerPersistentModuleHandler('Reviews', 'module.users.ui.login.succeeded', array('Reviews_Listener_UserLogin', 'succeeded'));
     EventUtil::registerPersistentModuleHandler('Reviews', 'module.users.ui.login.failed', array('Reviews_Listener_UserLogin', 'failed'));
     // user logout -> Reviews_Listener_UserLogout
     EventUtil::registerPersistentModuleHandler('Reviews', 'module.users.ui.logout.succeeded', array('Reviews_Listener_UserLogout', 'succeeded'));
     // user -> Reviews_Listener_User
     EventUtil::registerPersistentModuleHandler('Reviews', 'user.gettheme', array('Reviews_Listener_User', 'getTheme'));
     EventUtil::registerPersistentModuleHandler('Reviews', 'user.account.create', array('Reviews_Listener_User', 'create'));
     EventUtil::registerPersistentModuleHandler('Reviews', 'user.account.update', array('Reviews_Listener_User', 'update'));
     EventUtil::registerPersistentModuleHandler('Reviews', 'user.account.delete', array('Reviews_Listener_User', 'delete'));
     // registration -> Reviews_Listener_UserRegistration
     EventUtil::registerPersistentModuleHandler('Reviews', 'module.users.ui.registration.started', array('Reviews_Listener_UserRegistration', 'started'));
     EventUtil::registerPersistentModuleHandler('Reviews', 'module.users.ui.registration.succeeded', array('Reviews_Listener_UserRegistration', 'succeeded'));
     EventUtil::registerPersistentModuleHandler('Reviews', 'module.users.ui.registration.failed', array('Reviews_Listener_UserRegistration', 'failed'));
     EventUtil::registerPersistentModuleHandler('Reviews', 'user.registration.create', array('Reviews_Listener_UserRegistration', 'create'));
     EventUtil::registerPersistentModuleHandler('Reviews', 'user.registration.update', array('Reviews_Listener_UserRegistration', 'update'));
     EventUtil::registerPersistentModuleHandler('Reviews', 'user.registration.delete', array('Reviews_Listener_UserRegistration', 'delete'));
     // users module -> Reviews_Listener_Users
     EventUtil::registerPersistentModuleHandler('Reviews', 'module.users.config.updated', array('Reviews_Listener_Users', 'configUpdated'));
     // group -> Reviews_Listener_Group
     EventUtil::registerPersistentModuleHandler('Reviews', 'group.create', array('Reviews_Listener_Group', 'create'));
     EventUtil::registerPersistentModuleHandler('Reviews', 'group.update', array('Reviews_Listener_Group', 'update'));
     EventUtil::registerPersistentModuleHandler('Reviews', 'group.delete', array('Reviews_Listener_Group', 'delete'));
     EventUtil::registerPersistentModuleHandler('Reviews', 'group.adduser', array('Reviews_Listener_Group', 'addUser'));
     EventUtil::registerPersistentModuleHandler('Reviews', 'group.removeuser', array('Reviews_Listener_Group', 'removeUser'));
     // special purposes and 3rd party api support -> Reviews_Listener_ThirdParty
     EventUtil::registerPersistentModuleHandler('Reviews', 'get.pending_content', array('Reviews_Listener_ThirdParty', 'pendingContentListener'));
     EventUtil::registerPersistentModuleHandler('Reviews', 'module.content.gettypes', array('Reviews_Listener_ThirdParty', 'contentGetTypes'));
 }
开发者ID:rmaiwald,项目名称:Reviews,代码行数:73,代码来源:Installer.php

示例7: upgrade


//.........这里部分代码省略.........
             if (!ModUtil::registerHook('zikula', 'systeminit', 'GUI', 'scribite', 'user', 'run')) {
                 LogUtil::registerError($this->__('Error creating Hook!'));
                 return '2.2';
             }
             ModUtil::apiFunc('Modules', 'admin', 'enablehooks', array('callermodname' => 'zikula', 'hookmodname' => 'scribite'));
             LogUtil::registerStatus($this->__('<strong>scribite!</strong> was activated as core hook. You can check settings <a href="index.php?module=Modules&type=admin&func=hooks&id=0">here</a>!<br />The template plugin from previous versions of scribite! can be removed from templates.'));
         case '3.0':
             //create new module vars for Newsletter and Web_Links
             $record = array(array('modname' => 'Newsletter', 'modfuncs' => 'a:1:{i:0;s:11:"add_message";}', 'modareas' => 'a:1:{i:0;s:7:"message";}', 'modeditor' => '-'), array('modname' => 'crpVideo', 'modfuncs' => 'a:2:{i:0;s:3:"new";i:1;s:6:"modify";}', 'modareas' => 'a:1:{i:0;s:13:"video_content";}', 'modeditor' => '-'), array('modname' => 'Web_Links', 'modfuncs' => 'a:3:{i:0;s:8:"linkview";i:1;s:7:"addlink";i:2;s:17:"modifylinkrequest";}', 'modareas' => 'a:1:{i:0;s:11:"description";}', 'modeditor' => '-'));
             DBUtil::insertObjectArray($record, 'scribite', 'mid');
             // set vars for YUI Rich Text Editor
             if (!$this->getVar('yui_type')) {
                 $this->setVar('yui_type', 'Simple');
             }
             if (!$this->getVar('yui_width')) {
                 $this->setVar('yui_width', 'auto');
             }
             if (!$this->getVar('yui_height')) {
                 $this->setVar('yui_height', '300');
             }
             if (!$this->getVar('yui_dombar')) {
                 $this->setVar('yui_dombar', true);
             }
             if (!$this->getVar('yui_animate')) {
                 $this->setVar('yui_animate', true);
             }
             if (!$this->getVar('yui_collapse')) {
                 $this->setVar('yui_collapse', true);
             }
         case '3.1':
             // modify Profile module
             $originalconfig = ModUtil::apiFunc('Scribite', 'user', 'getModuleConfig', array('modulename' => "Profile"));
             $newconfig = array('mid' => $originalconfig['mid'], 'modulename' => 'Profile', 'modfuncs' => "modify", 'modareas' => "prop_signature,prop_extrainfo,prop_yinterests", 'modeditor' => $originalconfig['modeditor']);
             $modupdate = ModUtil::apiFunc('Scribite', 'admin', 'editmodule', $newconfig);
         case '3.2':
             // set new editors folder
             $this->setVar('editors_path', 'modules/scribite/pnincludes');
             LogUtil::registerStatus($this->__('<strong>Caution!</strong><br />All editors have moved to /modules/scribite/pnincludes in preparation for upcoming features of Zikula. Please check all your settings!<br />If you have adapted files from editors you have to check them too.<br /><br /><strong>Dropped support for FCKeditor and TinyMCE</strong><br />For security reasons these editors will not be supported anymore. Please change editors to an other editor.'));
         case '4.0':
         case '4.1':
         case '4.2':
             $this->setVar('nicedit_xhtml', 1);
         case '4.2.1':
             if (!$this->getVar('ckeditor_language')) {
                 $this->setVar('ckeditor_language', 'en');
             }
             if (!$this->getVar('ckeditor_barmode')) {
                 $this->setVar('ckeditor_barmode', 'Full');
             }
             if (!$this->getVar('ckeditor_width')) {
                 $this->setVar('ckeditor_width', '"70%"');
             }
             if (!$this->getVar('ckeditor_height')) {
                 $this->setVar('ckeditor_height', '400');
             }
         case '4.2.2':
             // this renames the table and the columns per new z1.3.0 standards
             $this->renameColumns();
             EventUtil::registerPersistentModuleHandler('Scribite', 'core.postinit', array('Scribite_Listeners', 'coreinit'));
             $this->setVar('editors_path', 'modules/Scribite/includes');
             LogUtil::registerStatus($this->__('<strong>Caution!</strong><br />All editors have moved to /modules/Scribite/includes.<br />If you have adapted files from editors you have to check them too.'));
         case '4.2.3':
             //set vars for markitup
             if (!$this->getVar('markitup_width')) {
                 $this->setVar('markitup_width', '650px');
             }
             if (!$this->getVar('markitup_height')) {
                 $this->setVar('markitup_height', '400px');
             }
             // remove fckeditor (was deprecated in 4.1)
             $this->delVar('fckeditor_language');
             $this->delVar('fckeditor_barmode');
             $this->delVar('fckeditor_width');
             $this->delVar('fckeditor_height');
             $this->delVar('fckeditor_autolang');
             // update module assignments to correct removed and deprecated editors
             $dbtable = DBUtil::getTables();
             $columns = $dbtable['scribite_column'];
             $sql = "UPDATE `{$dbtable['scribite']}` SET `{$columns['modeditor']}`='-' WHERE `{$columns['modeditor']}`='fckeditor' OR `{$columns['modeditor']}`='tinymce' OR `{$columns['modeditor']}`='openwysiwyg'";
             DBUtil::executeSQL($sql);
             // reset modules
             $this->resetModuleConfig('News');
             $this->resetModuleConfig('Pages');
             $this->resetModuleConfig('ContentExpress');
             $this->resetModuleConfig('Mediashare');
             // correct possible serialized data corruption
             if (!DataUtil::is_serialized($this->getVar('xinha_activeplugins'))) {
                 $this->delVar('xinha_activeplugins');
             }
             // relocate xinha styles
             $this->setVar('xinha_style', 'modules/Scribite/style/xinha/editor.css');
             // remove content settings
             DBUtil::deleteObjectById('scribite', 'content', 'modname');
         case '4.3.0':
             /* reimplement TinyMCE */
             // future updates
             // notice - remove openwysiwyg vars @>4.3.0
     }
     return true;
 }
开发者ID:rmaiwald,项目名称:Scribite,代码行数:101,代码来源:Installer.php

示例8: upgrade

    /**
     * Upgrade the module from a prior 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 The version number string from which the upgrade starting.
     *
     * @return boolean|string True if the module is successfully upgraded to the current version; last valid version string or false if the upgrade fails.
     */
    function upgrade($oldVersion)
    {
        // Upgrade dependent on old version number
        switch ($oldVersion)
        {
            case '1.1':
                // Upgrade 1.1 -> 1.2
                $this->setVar('termsofuse', true);
                $this->setVar('privacypolicy', true);
                $this->setVar('accessibilitystatement', true);

            case '1.2':
                // Upgrade 1.2 -> 1.3
                // Nothing to do.

            case '1.3':
                // Upgrade 1.3 -> 2.0.0
                // Convert the module variables to the new names
                $this->setVar(Legal_Constant::MODVAR_TERMS_ACTIVE, $this->getVar('termsofuse', true));
                $this->delVar('termsofuse');
                $this->setVar(Legal_Constant::MODVAR_PRIVACY_ACTIVE, $this->getVar('privacypolicy', true));
                $this->delVar('privacypolicy');
                $this->setVar(Legal_Constant::MODVAR_ACCESSIBILITY_ACTIVE, $this->getVar('accessibilitystatement', true));
                $this->delVar('accessibilitystatement');

                // Set the new module variable -- but if Users set it for us during its upgrade, then don't overwrite it
                $this->setVar(Legal_Constant::MODVAR_MINIMUM_AGE, $this->getVar(Legal_Constant::MODVAR_MINIMUM_AGE, 0));

                // Set up the new persistent event handler, and any other event-related features.
                EventUtil::registerPersistentModuleHandler($this->name, 'user.login.veto', array('Legal_Listener_UsersLoginVeto', 'acceptPoliciesListener'));
                EventUtil::registerPersistentEventHandlerClass($this->name, 'Legal_Listener_UsersUiHandler');

            case '2.0.0':
                // Upgrade 2.0.0 -> 2.0.1
                // add vars for new document types
                $this->setVar(Legal_Constant::MODVAR_LEGALNOTICE_ACTIVE, false);
                $this->setVar(Legal_Constant::MODVAR_CANCELLATIONRIGHTPOLICY_ACTIVE, false);
                $this->setVar(Legal_Constant::MODVAR_TRADECONDITIONS_ACTIVE, false);

                // add vars for optional custom urls
                $this->setVar(Legal_Constant::MODVAR_LEGALNOTICE_URL, '');
                $this->setVar(Legal_Constant::MODVAR_TERMS_URL, '');
                $this->setVar(Legal_Constant::MODVAR_PRIVACY_URL, '');
                $this->setVar(Legal_Constant::MODVAR_ACCESSIBILITY_URL, '');
                $this->setVar(Legal_Constant::MODVAR_CANCELLATIONRIGHTPOLICY_URL, '');
                $this->setVar(Legal_Constant::MODVAR_TRADECONDITIONS_URL, '');

            case '2.0.1':
                // Upgrade 2.0.1 -> ?.?.?

                // The following break should be the only one in the switch, and should appear immediately prior to the default case.
                break;
            default:
                $this->registerError($this->__f('Upgrading the Legal module from version %1$s to %2$s is not supported.', array($oldVersion, $this->version->getVersion())));
                return $oldVersion;
        }

        // Update successful
        return true;
    }
开发者ID:projectesIF,项目名称:Sirius,代码行数:70,代码来源:Installer.php

示例9: upgrade

    /**
     * Upgrade the users module from an older 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)
    {
        // $oldversion 1.9 and 1.10 handled by Zikula 1.2.
        if (version_compare($oldVersion, '1.11') === -1) {
            return $oldVersion;
        }
        // Versions 1.14 through 2.1.0 were development versions that were released only to developers, and many changes
        // over the course of those versions regarding database structure were radically modified. Upgrading from any of
        // those versions is not possible.
        if ((version_compare($oldVersion, '1.13') === 1) && (version_compare($oldVersion, '2.2.0') === -1)) {
            return $oldVersion;
        }

        // Upgrade dependent on old version number
        switch ($oldVersion) {
            case '1.11':
                // upgrade 1.11 to 1.12
                $this->upgrade_migrateSerialisedUserTemp();
            case '1.12':
                // upgrade 1.12 to 1.13

                // Do modvar renames and moves here, but new modvars and modvar removals are done below for all versions
                $this->setVar(Users_Constant::MODVAR_AVATAR_IMAGE_PATH, Users_Constant::MODVAR_AVATAR_IMAGE_PATH);
                // lowercaseuname Removed in 2.0.0
                //$this->setVar('lowercaseuname', 1);

                // **************************************************************
                // 1.12->1.13 is the last known upgrade of Users for Zikula 1.2.x
                // Users module 1.13 is the last known 1.2.x version released.
                // If the 1.2.x branch gets a new version, this must be updated.
                // **************************************************************
            case '1.13':
                // upgrade 1.13 to 2.2.0

                // Do modvar renames and moves here, but new modvars and modvar removals are done below for all versions

                // Check if the hash method is md5. If so, it is not used any more. Change it to the new default.
                if ($this->getVar(Users_Constant::MODVAR_HASH_METHOD, false) == 'md5') {
                    $this->setVar(Users_Constant::MODVAR_HASH_METHOD, Users_Constant::DEFAULT_HASH_METHOD);
                }

                // Convert the banned user names to a comma separated list.
                $bannedUnames = $this->getVar(Users_Constant::MODVAR_REGISTRATION_ILLEGAL_UNAMES, '');
                $bannedUnames = preg_split('/\s+/', $bannedUnames);
                $bannedUnames = implode(', ', $bannedUnames);
                $this->setVar(Users_Constant::MODVAR_REGISTRATION_ILLEGAL_UNAMES, $bannedUnames);

                // System-generated passwords are deprecated since 1.3.0. Change it to
                // User-generated passwords.
                $regVerifyEmail = $this->getVar(Users_Constant::MODVAR_REGISTRATION_VERIFICATION_MODE, Users_Constant::VERIFY_NO);
                if ($regVerifyEmail == Users_Constant::VERIFY_SYSTEMPWD) {
                    $this->setVar(Users_Constant::MODVAR_REGISTRATION_VERIFICATION_MODE, Users_Constant::VERIFY_USERPWD);
                }

                // IDN domains setting moving to system settings.
                System::setVar('idnnames', (bool)$this->getVar('idnnames', true));

                // Minimum age is moving to Legal
                ModUtil::setVar('Legal', 'minimumAge', $this->getVar('minage', 0));

                if (!$this->upgrade113XTablesTo220Tables($oldVersion)) {
                    return '1.13';
                }

                EventUtil::registerPersistentModuleHandler($this->name, 'get.pending_content', array('Users_Listener_PendingContent', 'pendingContentListener'));
                EventUtil::registerPersistentModuleHandler($this->name, 'user.login.veto', array('Users_Listener_ForcedPasswordChange', 'forcedPasswordChangeListener'));
                EventUtil::registerPersistentModuleHandler($this->name, 'user.logout.succeeded', array('Users_Listener_ClearUsersNamespace', 'clearUsersNamespaceListener'));
                EventUtil::registerPersistentModuleHandler($this->name, 'frontcontroller.exception', array('Users_Listener_ClearUsersNamespace', 'clearUsersNamespaceListener'));
                HookUtil::registerSubscriberBundles($this->version->getHookSubscriberBundles());
                HookUtil::registerProviderBundles($this->version->getHookProviderBundles());
            case '2.2.0':
                // This s the current version: add 2.2.0 --> next when appropriate
        }

        $currentModVars = $this->getVars();
        $defaultModVars = $this->getDefaultModvars();

        // Remove modvars that are no longer defined.
        foreach ($currentModVars as $modVar => $currentValue) {
            if (!array_key_exists($modVar, $defaultModVars)) {
                $this->delVar($modVar);
            }
        }

        // Add modvars that are new to the version
        foreach ($defaultModVars as $modVar => $defaultValue) {
            if (!array_key_exists($modVar, $currentModVars)) {
                $this->setVar($modVar, $defaultValue);
            }
        }
//.........这里部分代码省略.........
开发者ID:projectesIF,项目名称:Sirius,代码行数:101,代码来源:Installer.php

示例10: upgrade

 /**
  * Upgrade module
  *
  * @param   string    $oldversion
  * @return  boolean   true/false
  */
 public function upgrade($oldversion)
 {
     // upgrade dependent on old version number
     switch ($oldversion) {
         case '2.0':
             $table_prefix = 'phpbb_';
             $this->setVar('table_prefix', $table_prefix);
             $connection = Doctrine_Manager::getInstance()->getCurrentConnection();
             // drop system table prefix (depreciated)
             $stmt = $connection->prepare("SHOW TABLES LIKE '%" . $table_prefix . "_%'");
             try {
                 $stmt->execute();
             } catch (Exception $e) {
                 return LogUtil::registerError(__('Error: ') . $e->getMessage());
             }
             $items = $stmt->fetchAll(Doctrine_Core::FETCH_NUM);
             foreach ($items as $item) {
                 $pos = strpos($item[0], $table_prefix);
                 if ($pos > 0) {
                     $stmt = $connection->prepare('RENAME TABLE ' . $item[0] . " TO " . substr($item[0], $pos));
                     try {
                         $stmt->execute();
                     } catch (Exception $e) {
                         return LogUtil::registerError(__('Error: ') . $e->getMessage());
                     }
                 }
             }
             // Register hooks
             $sqlQueries = array();
             $sqlQueries[] = 'DELETE FROM `hook_area` WHERE `owner`="ZphpBB2"';
             $sqlQueries[] = 'DELETE FROM `hook_subscriber` WHERE `owner`="ZphpBB2"';
             foreach ($sqlQueries as $sql) {
                 $stmt = $connection->prepare($sql);
                 try {
                     $stmt->execute();
                 } catch (Exception $e) {
                 }
             }
             HookUtil::registerSubscriberBundles($this->version->getHookSubscriberBundles());
         case '2.1.0':
             // Register event handlers
             EventUtil::registerPersistentModuleHandler('ZphpBB2', 'user.account.create', array('ZphpBB2_Listener_UsersSynch', 'createAccountListener'));
             EventUtil::registerPersistentModuleHandler('ZphpBB2', 'user.account.update', array('ZphpBB2_Listener_UsersSynch', 'updateAccountListener'));
             EventUtil::registerPersistentModuleHandler('ZphpBB2', 'user.account.delete', array('ZphpBB2_Listener_UsersSynch', 'deleteAccountListener'));
         case '2.1.1':
             // future upgrade routines
     }
     return true;
 }
开发者ID:nmpetkov,项目名称:ZphpBB2,代码行数:55,代码来源:Installer.php

示例11: contentUpgrade_4_0_0

 protected function contentUpgrade_4_0_0($oldVersion)
 {
     // remove table prefixes manually if needed
     $prefix = $this->serviceManager['prefix'];
     if (!empty($prefix)) {
         $connection = Doctrine_Manager::getInstance()->getConnection('default');
         $sqlStatements = array();
         // remove table prefix with SQL calls, there is no IF NOT EXISTS on RENAME
         $sqlStatements[] = 'RENAME TABLE ' . $prefix . '_content_content' . " TO content_content";
         $sqlStatements[] = 'RENAME TABLE ' . $prefix . '_content_history' . " TO content_history";
         $sqlStatements[] = 'RENAME TABLE ' . $prefix . '_content_page' . " TO content_page";
         $sqlStatements[] = 'RENAME TABLE ' . $prefix . '_content_pagecategory' . " TO content_pagecategory";
         $sqlStatements[] = 'RENAME TABLE ' . $prefix . '_content_searchable' . " TO content_searchable";
         $sqlStatements[] = 'RENAME TABLE ' . $prefix . '_content_translatedcontent' . " TO content_translatedcontent";
         $sqlStatements[] = 'RENAME TABLE ' . $prefix . '_content_translatedpage' . " TO content_translatedpage";
         foreach ($sqlStatements as $sql) {
             $statement = $connection->prepare($sql);
             try {
                 $statement->execute();
             } catch (Exception $e) {
                 LogUtil::registerStatus($this->__f('Table rename failed: %s.', array($e->getMessage())));
             }
         }
     }
     // update tables with new indexes
     if (!DBUtil::changeTable('content_page')) {
         return false;
     }
     if (!DBUtil::changeTable('content_content')) {
         return false;
     }
     if (!DBUtil::changeTable('content_translatedpage')) {
         return false;
     }
     if (!DBUtil::changeTable('content_translatedcontent')) {
         return false;
     }
     if (!DBUtil::changeTable('content_history')) {
         return false;
     }
     // upgrade Content's layoutTypes, if layouts do not exist in the new version return an error !
     if (!self::updateLayout()) {
         return false;
     }
     // upgrade the Content module's ContentTypes
     self::updateContentType();
     // upgrade other module's ContentTypes if available
     ModUtil::apiFunc('Content', 'admin', 'upgradecontenttypes');
     // Register for hook subscribing
     HookUtil::registerSubscriberBundles($this->version->getHookSubscriberBundles());
     // register handlers
     EventUtil::registerPersistentModuleHandler('Content', 'module.content.gettypes', array('Content_Util', 'getTypes'));
     return true;
 }
开发者ID:robbrandt,项目名称:Content,代码行数:54,代码来源:Installer.php

示例12: 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

示例13: upgrade

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

示例14: upgrade


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


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