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


PHP CacheUtil::clearLocalDir方法代码示例

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


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

示例1: updateconfig


//.........这里部分代码省略.........
            $sessionregeneratefreq = 10;
        }
        System::setVar('sessionregeneratefreq', $sessionregeneratefreq);

        $sessionipcheck = (int)FormUtil::getPassedValue('sessionipcheck', 0, 'POST');
        System::setVar('sessionipcheck', $sessionipcheck);

        $sessionname = FormUtil::getPassedValue('sessionname', 'ZSID', 'POST');
        if (strlen($sessionname) < 3) {
            $sessionname = 'ZSID';
        }

        $sessioncsrftokenonetime = (int)FormUtil::getPassedValue('sessioncsrftokenonetime', 0, 'POST');
        System::setVar('sessioncsrftokenonetime', $sessioncsrftokenonetime);

        // cause logout if we changed session name
        if ($sessionname != System::getVar('sessionname')) {
            $cause_logout = true;
        }

        System::setVar('sessionname', $sessionname);
        System::setVar('sessionstoretofile', $sessionstoretofile);

        $outputfilter = FormUtil::getPassedValue('outputfilter', 0, 'POST');
        System::setVar('outputfilter', $outputfilter);

        $useids = (bool)FormUtil::getPassedValue('useids', 0, 'POST');
        System::setVar('useids', $useids);

        // create tmp directory for PHPIDS
        if ($useids == 1) {
            $idsTmpDir = CacheUtil::getLocalDir() . '/idsTmp';
            if (!file_exists($idsTmpDir)) {
                CacheUtil::clearLocalDir('idsTmp');
            }
        }

        $idssoftblock = (bool)FormUtil::getPassedValue('idssoftblock', 1, 'POST');
        System::setVar('idssoftblock', $idssoftblock);

        $idsmail = (bool)FormUtil::getPassedValue('idsmail', 1, 'POST');
        System::setVar('idsmail', $idsmail);

        $idsfilter = FormUtil::getPassedValue('idsfilter', 'xml', 'POST');
        System::setVar('idsfilter', $idsfilter);

        $idsrulepath = FormUtil::getPassedValue('idsrulepath', 'config/zikula_default.xml', 'POST');
        $idsrulepath = DataUtil::formatForOS($idsrulepath);
        if (is_readable($idsrulepath)) {
            System::setVar('idsrulepath', $idsrulepath);
        } else {
            LogUtil::registerError($this->__f('Error! PHPIDS rule file %s does not exist or is not readable.', $idsrulepath));
            $validates = false;
        }

        $idsimpactthresholdone = (int)FormUtil::getPassedValue('idsimpactthresholdone', 1, 'POST');
        System::setVar('idsimpactthresholdone', $idsimpactthresholdone);

        $idsimpactthresholdtwo = (int)FormUtil::getPassedValue('idsimpactthresholdtwo', 10, 'POST');
        System::setVar('idsimpactthresholdtwo', $idsimpactthresholdtwo);

        $idsimpactthresholdthree = (int)FormUtil::getPassedValue('idsimpactthresholdthree', 25, 'POST');
        System::setVar('idsimpactthresholdthree', $idsimpactthresholdthree);

        $idsimpactthresholdfour = (int)FormUtil::getPassedValue('idsimpactthresholdfour', 75, 'POST');
        System::setVar('idsimpactthresholdfour', $idsimpactthresholdfour);
开发者ID:projectesIF,项目名称:Sirius,代码行数:67,代码来源:Admin.php

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


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