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


PHP eZPHPCreator::store方法代码示例

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


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

示例1: dailyValue

    /**
     * @param string $name
     * @param mixed $value
     * @param string $cacheFileName
     * @return mixed|null
     */
    public static function dailyValue( $name, $value = null, $cacheFileName = null )
    {
        if ( $value === null && isset($memoryCache[$name]) && $cacheFileName === null )
        {
            return self::$memoryCache[$name];
        }
        else
        {
            if (is_null($cacheFileName))
            {
                $cacheFileName = self::DAILY_CACHE_FILE . '_' . ClusterTool::clusterIdentifier();
            }

            $cache = new eZPHPCreator(
                eZSys::cacheDirectory(),
                $cacheFileName . '.php',
                '',
                array()
            );

            $expiryTime = time() - 24 * 3600;

            // reading
            if ($cache->canRestore($expiryTime))
            {
                $values = $cache->restore(array('cacheTable' => 'cacheTable'));

                if (is_null($value))
                {
                    if (isset($values['cacheTable'][$name]))
                    {
                        return $values['cacheTable'][$name];
                    }
                    else
                    {
                        return null;
                    }
                }
            }
            else
            {
                $values = array('cacheTable' => array());
            }

            $values['cacheTable'][$name] = $value;
            if ( $cacheFileName == self::DAILY_CACHE_FILE . '_' . ClusterTool::clusterIdentifier() )
                self::$memoryCache = $values['cacheTable'];

            // writing
            $cache->addVariable('cacheTable', $values['cacheTable']);
            $cache->store(true);
            $cache->close();
        }

        return null;
    }
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:62,代码来源:cacheTool.php

示例2: dailyValue

    /**
     * @param string $name
     * @param mixed $value
     * @return array
     */
    public static function dailyValue( $name, $value = null)
    {
        if ( $value === null && isset($memoryCache[$name]) )
        {
            return self::$memoryCache[$name];
        }
        else
        {
            $cache = new eZPHPCreator(
                eZSys::cacheDirectory(),
                self::GLOBAL_CACHE_FILE . '.php',
                '',
                array() // removed clustering
            );

            $expiryTime = time() - 24 * 3600;

            // reading
            if ($cache->canRestore($expiryTime))
            {
                $values = $cache->restore(array('cacheTable' => 'cacheTable'));
                self::$memoryCache = $values['cacheTable'];

                if (is_null($value))
                {
                    if (isset($values['cacheTable'][$name]))
                    {
                        return $values['cacheTable'][$name];
                    }
                    else
                    {
                        return null;
                    }
                }
            }
            else
            {
                $values = array('cacheTable' => array());
            }

            if ( !is_null($value) )
            {
                $values['cacheTable'][$name] = $value;
                $cache->addVariable('cacheTable', $values['cacheTable']);
                $cache->store(true);
                $cache->close();
            }
        }

        return null;
    }
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:56,代码来源:globalCacheTool.php

示例3: createOverrideCache

 function createOverrideCache()
 {
     if (isset($GLOBALS['eZSiteBasics'])) {
         if (isset($GLOBALS['eZSiteBasics']['no-cache-adviced']) and $GLOBALS['eZSiteBasics']['no-cache-adviced']) {
             return false;
         }
     }
     global $eZTemplateOverrideCacheNoPermission;
     if ($eZTemplateOverrideCacheNoPermission == "nocache") {
         return false;
     }
     $ini = eZINI::instance('site.ini');
     $useOverrideCache = true;
     if ($ini->hasVariable('OverrideSettings', 'Cache')) {
         $useOverrideCache = $ini->variable('OverrideSettings', 'Cache') == 'enabled';
     }
     $standardBase = eZTemplateDesignResource::designSetting('standard');
     $siteBase = eZTemplateDesignResource::designSetting('site');
     $overrideKeys = $this->overrideKeys();
     $overrideKey = md5(implode(',', $overrideKeys) . $siteBase . $standardBase);
     $cacheDir = eZSys::cacheDirectory();
     $overrideCacheFile = $cacheDir . '/override/override_' . $overrideKey . '.php';
     // Build matching cache only of it does not already exists,
     // or override file has been updated
     if (!$useOverrideCache or !file_exists($overrideCacheFile)) {
         $matchFileArray = eZTemplateDesignResource::overrideArray($this->OverrideSiteAccess);
         // Generate PHP compiled cache file.
         $phpCache = new eZPHPCreator("{$cacheDir}/override", "override_{$overrideKey}.php");
         $phpCode = "\$GLOBALS['eZOverrideTemplateCacheMap'] = array (\n";
         $numMatchFiles = count($matchFileArray);
         $countMatchFiles = 0;
         //            $phpCode .= "switch ( \$matchFile )\n{\n    ";
         foreach (array_keys($matchFileArray) as $matchKey) {
             $countMatchFiles++;
             $phpCode .= '\'' . md5($matchKey) . '\' => ';
             if (isset($matchFileArray[$matchKey]['custom_match'])) {
                 $baseDir = isset($matchFileArray[$matchKey]['base_dir']) ? $matchFileArray[$matchKey]['base_dir'] : '';
                 $defaultMatchFile = $baseDir . $matchKey;
                 // Custom override matching
                 //                    $phpCode .= "    case  \"$matchKey\":\n    {\n";
                 $matchConditionArray = array();
                 foreach ($matchFileArray[$matchKey]['custom_match'] as $customMatch) {
                     $matchCondition = "";
                     $condCount = 0;
                     if (is_array($customMatch['conditions'])) {
                         foreach (array_keys($customMatch['conditions']) as $conditionKey) {
                             if ($condCount > 0) {
                                 $matchCondition .= " and ";
                             }
                             // Have a special substring match for subtree matching
                             $matchCondition .= "( isset( \$matchKeys[\\'{$conditionKey}\\'] ) and ";
                             if ($conditionKey == 'url_alias') {
                                 $matchCondition .= "( strpos( \$matchKeys[\\'url_alias\\'],  \\'" . $customMatch['conditions']['url_alias'] . "\\' ) === 0 ) )";
                             } else {
                                 $matchCondition .= "( is_array( \$matchKeys[\\'{$conditionKey}\\'] ) ? " . "in_array( \\'" . $customMatch['conditions'][$conditionKey] . "\\', \$matchKeys[\\'{$conditionKey}\\'] ) : " . "\$matchKeys[\\'{$conditionKey}\\'] == \\'" . $customMatch['conditions'][$conditionKey] . "\\') )";
                             }
                             $condCount++;
                         }
                     }
                     // Only create custom match if conditions are defined
                     if ($matchCondition != "") {
                         //                            $phpCode .= "        if ( $matchCondition )\n        {\n";
                         //                            $phpCode .= "            return '" . $customMatch['match_file'] . "';\n        }\n";
                         if ($condCount > 1) {
                             $matchConditionArray[] = array('condition' => '(' . $matchCondition . ')', 'matchFile' => $customMatch['match_file']);
                         } else {
                             $matchConditionArray[] = array('condition' => $matchCondition, 'matchFile' => $customMatch['match_file']);
                         }
                     } else {
                         // No override conditions defined. Override default match file
                         $defaultMatchFile = $customMatch['match_file'];
                     }
                 }
                 $phpCode .= "array ( 'eval' => 1, 'code' => ";
                 $phpCode .= "'";
                 foreach (array_keys($matchConditionArray) as $key) {
                     $phpCode .= '(' . $matchConditionArray[$key]['condition'] . ' ? ' . "\\'" . $matchConditionArray[$key]['matchFile'] . "\\'" . ' : ';
                 }
                 $phpCode .= "\\'" . $defaultMatchFile . "\\'";
                 for ($condCount = 0; $condCount < count($matchConditionArray); $condCount++) {
                     $phpCode .= ')';
                 }
                 $phpCode .= "' )";
             } else {
                 $phpCode .= "'" . $matchFileArray[$matchKey]['base_dir'] . $matchKey . "'";
             }
             if ($countMatchFiles < $numMatchFiles) {
                 $phpCode .= ",\n";
             } else {
                 $phpCode .= ");\n";
             }
         }
         $phpCache->addCodePiece($phpCode);
         if ($useOverrideCache and $phpCache->store()) {
         } else {
             if ($useOverrideCache) {
                 eZDebug::writeError("Could not write template override cache file, check permissions in {$cacheDir}/override/.\nRunning eZ Publish without this cache will have a performance impact.", __METHOD__);
             }
             $eZTemplateOverrideCacheNoPermission = 'nocache';
             $overrideCacheFile = false;
//.........这里部分代码省略.........
开发者ID:patrickallaert,项目名称:ezpublish-legacy-php7,代码行数:101,代码来源:eztemplatedesignresource.php

示例4: createCommonCompileTemplate

 static function createCommonCompileTemplate()
 {
     $php = new eZPHPCreator(eZTemplateCompiler::compilationDirectory(), 'common.php');
     if ($php->exists()) {
         return;
     }
     $php->addComment("This file contains functions which are common to all compiled templates.\n\n" . 'NOTE: This file is autogenerated and should not be modified, any changes will be lost!');
     $php->addSpace();
     $php->addDefine('EZ_TEMPLATE_COMPILER_COMMON_CODE', true);
     $php->addSpace();
     $namespaceStack = array();
     $php->addCodePiece("if ( !isset( \$namespaceStack ) )\n");
     $php->addVariable('namespaceStack', $namespaceStack, eZPHPCreator::VARIABLE_ASSIGNMENT, array('spacing' => 4));
     $php->addSpace();
     $lbracket = '{';
     $rbracket = '}';
     $initText = "if ( !function_exists( 'compiledfetchvariable' ) )\n{$lbracket}\n    function compiledFetchVariable( \$vars, \$namespace, \$name )\n    {$lbracket}\n        \$exists = ( array_key_exists( \$namespace, \$vars ) and\n                    array_key_exists( \$name, \$vars[\$namespace] ) );\n        if ( \$exists )\n        {$lbracket}\n            return \$vars[\$namespace][\$name];\n        {$rbracket}\n        return null;\n    {$rbracket}\n{$rbracket}\nif ( !function_exists( 'compiledfetchtext' ) )\n{$lbracket}\n    function compiledFetchText( \$tpl, \$rootNamespace, \$currentNamespace, \$namespace, \$var )\n    {$lbracket}\n        \$text = '';\n        \$tpl->appendElement( \$text, \$var, \$rootNamespace, \$currentNamespace );\n        return \$text;\n    {$rbracket}\n{$rbracket}\nif ( !function_exists( 'compiledAcquireResource' ) )\n{$lbracket}\n    function compiledAcquireResource( \$phpScript, \$key, &\$originalText,\n                                      \$tpl, \$rootNamespace, \$currentNamespace )\n    {\n        include( '" . eZTemplateCompiler::TemplatePrefix() . "' . \$phpScript );\n        if ( isset( \$text ) )\n        {\n            \$originalText .= \$text;\n            return true;\n        }\n        return false;\n    }\n{$rbracket}\nif ( !function_exists( 'compiledfetchattribute' ) )\n{$lbracket}\n    function compiledFetchAttribute( \$value, \$attributeValue )\n    {$lbracket}\n        if ( is_object( \$value ) )\n        {$lbracket}\n            if ( method_exists( \$value, \"attribute\" ) and\n                 method_exists( \$value, \"hasattribute\" ) )\n            {$lbracket}\n                if ( \$value->hasAttribute( \$attributeValue ) )\n                {$lbracket}\n                    return \$value->attribute( \$attributeValue );\n                {$rbracket}\n            {$rbracket}\n        {$rbracket}\n        else if ( is_array( \$value ) )\n        {$lbracket}\n            if ( isset( \$value[\$attributeValue] ) )\n            {$lbracket}\n                return \$value[\$attributeValue];\n            {$rbracket}\n        {$rbracket}\n        return null;\n    {$rbracket}\n{$rbracket}\n";
     $php->addCodePiece($initText);
     $php->store(true);
 }
开发者ID:runelangseid,项目名称:ezpublish,代码行数:20,代码来源:eztemplatecompiler.php

示例5: classIdentifiersHash

 /**
  * Returns the class identifier hash for the current database.
  * If it is outdated or non-existent, the method updates/generates the file
  *
  * @static
  * @since Version 4.1
  * @access protected
  * @return array Returns hash of classidentifier => classid
  */
 protected static function classIdentifiersHash()
 {
     if (self::$identifierHash === null) {
         $db = eZDB::instance();
         $dbName = md5($db->DB);
         $cacheDir = eZSys::cacheDirectory();
         $phpCache = new eZPHPCreator($cacheDir, 'classidentifiers_' . $dbName . '.php', '', array('clustering' => 'classidentifiers'));
         eZExpiryHandler::registerShutdownFunction();
         $handler = eZExpiryHandler::instance();
         $expiryTime = 0;
         if ($handler->hasTimestamp('class-identifier-cache')) {
             $expiryTime = $handler->timestamp('class-identifier-cache');
         }
         if ($phpCache->canRestore($expiryTime)) {
             $var = $phpCache->restore(array('identifierHash' => 'identifier_hash'));
             self::$identifierHash = $var['identifierHash'];
         } else {
             // Fetch identifier/id pair from db
             $query = "SELECT id, identifier FROM ezcontentclass where version=0";
             $identifierArray = $db->arrayQuery($query);
             self::$identifierHash = array();
             foreach ($identifierArray as $identifierRow) {
                 self::$identifierHash[$identifierRow['identifier']] = $identifierRow['id'];
             }
             // Store identifier list to cache file
             $phpCache->addVariable('identifier_hash', self::$identifierHash);
             $phpCache->store();
         }
     }
     return self::$identifierHash;
 }
开发者ID:nlenardou,项目名称:ezpublish,代码行数:40,代码来源:ezcontentclass.php

示例6: activeExtensions

    /**
     * Return an array with activated extensions.
     *
     * @note Default extensions are those who are loaded before a siteaccess are determined while access extensions
     *       are loaded after siteaccess is set.
     *
     * @param false|string $extensionType Decides which extension to include in the list, the follow values are possible:
     *                                    - false - Means add both default and access extensions
     *                                    - 'default' - Add only default extensions
     *                                    - 'access' - Add only access extensions
     * @param eZINI|null $siteINI Optional parameter to be able to only do change on specific instance of site.ini
     * @return array
     */
    public static function activeExtensions( $extensionType = false, eZINI $siteINI = null )
    {
        if ( $siteINI === null )
        {
            $siteINI = eZINI::instance();
        }

        $activeExtensions = array();
        if ( !$extensionType || $extensionType === 'default' )
        {
            $activeExtensions = $siteINI->variable( 'ExtensionSettings', 'ActiveExtensions' );
        }

        if ( !$extensionType || $extensionType === 'access' )
        {
            $activeExtensions = array_merge( $activeExtensions,
                                             $siteINI->variable( 'ExtensionSettings', 'ActiveAccessExtensions' ) );
        }

        if ( isset( $GLOBALS['eZActiveExtensions'] ) )
        {
            $activeExtensions = array_merge( $activeExtensions,
                                             $GLOBALS['eZActiveExtensions'] );
        }

        // return empty array as is to avoid further unneeded overhead
        if ( !isset( $activeExtensions[0] ) )
        {
            return $activeExtensions;
        }

        // return array as is if ordering is disabled to avoid cache overhead
        $activeExtensions = array_unique( $activeExtensions );
        if ( $siteINI->variable( 'ExtensionSettings', 'ExtensionOrdering' ) !== 'enabled' )
        {
            // @todo Introduce a debug setting or re use existing dev mods to check that all extensions exists
            return $activeExtensions;
        }

        $cacheIdentifier = md5( serialize( $activeExtensions ) );
        if ( isset ( self::$activeExtensionsCache[$cacheIdentifier] ) )
        {
            return self::$activeExtensionsCache[$cacheIdentifier];
        }

        // cache has to be stored by siteaccess + $extensionType
        $extensionDirectory = self::baseDirectory();
        $expiryHandler = eZExpiryHandler::instance();
        $phpCache = new eZPHPCreator( self::CACHE_DIR, "active_extensions_{$cacheIdentifier}.php" );
        $expiryTime = $expiryHandler->hasTimestamp( 'active-extensions-cache' ) ? $expiryHandler->timestamp( 'active-extensions-cache' ) : 0;

        if ( !$phpCache->canRestore( $expiryTime ) )
        {
            self::$activeExtensionsCache[$cacheIdentifier] = self::extensionOrdering( $activeExtensions );

            // Check that all extensions defined actually exists before storing cache
            foreach ( self::$activeExtensionsCache[$cacheIdentifier] as $activeExtension )
            {
                if ( !file_exists( $extensionDirectory . '/' . $activeExtension ) )
                {
                    eZDebug::writeError( "Extension '$activeExtension' does not exist, looked for directory '" . $extensionDirectory . '/' . $activeExtension . "'", __METHOD__ );
                }
            }

            $phpCache->addVariable( 'activeExtensions', self::$activeExtensionsCache[$cacheIdentifier] );
            $phpCache->store();
        }
        else
        {
            $data = $phpCache->restore( array( 'activeExtensions' => 'activeExtensions' ) );
            self::$activeExtensionsCache[$cacheIdentifier] = $data['activeExtensions'];
        }

        return self::$activeExtensionsCache[$cacheIdentifier];
    }
开发者ID:nottavi,项目名称:ezpublish,代码行数:88,代码来源:ezextension.php

示例7: storeCache

 static function storeCache($key, $templateFilepath)
 {
     if (!eZTemplateTreeCache::isCacheEnabled()) {
         return false;
     }
     $templateCache =& eZTemplateTreeCache::cacheTable();
     $key = eZTemplateTreeCache::internalKey($key);
     if (!isset($templateCache[$key])) {
         eZDebug::writeDebug("Template cache for key '{$key}' does not exist, cannot store cache", __METHOD__);
         return;
     }
     $cacheFileName = eZTemplateTreeCache::treeCacheFilename($key, $templateFilepath);
     $cache =& $templateCache[$key];
     $php = new eZPHPCreator(eZTemplateTreeCache::cacheDirectory(), $cacheFileName);
     $php->addVariable('eZTemplateTreeCacheCodeDate', eZTemplateTreeCache::CODE_DATE);
     $php->addSpace();
     $php->addVariable('TemplateInfo', $cache['info']);
     $php->addSpace();
     $php->addVariable('TemplateRoot', $cache['root']);
     $php->store();
 }
开发者ID:nfrp,项目名称:ezpublish,代码行数:21,代码来源:eztemplatetreecache.php

示例8: storeCache

 static function storeCache($key)
 {
     $translationCache = eZTranslationCache::cacheTable();
     if (!isset($translationCache[$key])) {
         eZDebug::writeWarning("Translation cache for key '{$key}' does not exist, cannot store cache", __METHOD__);
         return;
     }
     $internalCharset = eZTextCodec::internalCharset();
     //         $cacheFileKey = "$key-$internalCharset";
     $cacheFileKey = $key;
     $cacheFileName = md5($cacheFileKey) . '.php';
     $cache =& $translationCache[$key];
     if (!file_exists(eZTranslationCache::cacheDirectory())) {
         eZDir::mkdir(eZTranslationCache::cacheDirectory(), false, true);
     }
     $php = new eZPHPCreator(eZTranslationCache::cacheDirectory(), $cacheFileName);
     $php->addRawVariable('eZTranslationCacheCodeDate', self::CODE_DATE);
     $php->addSpace();
     $php->addRawVariable('CacheInfo', array('charset' => $internalCharset));
     $php->addRawVariable('TranslationInfo', $cache['info']);
     $php->addSpace();
     $php->addRawVariable('TranslationRoot', $cache['root']);
     $php->store();
 }
开发者ID:legende91,项目名称:ez,代码行数:24,代码来源:eztranslationcache.php

示例9: limitations

 /**
  * Returns an array of limitations useable by the policy system
  *
  * @return array
  */
 public static function limitations()
 {
     static $limitations;
     if ($limitations === null) {
         $db = eZDB::instance();
         $dbName = md5($db->DB);
         $cacheDir = eZSys::cacheDirectory();
         $phpCache = new eZPHPCreator($cacheDir, 'statelimitations_' . $dbName . '.php', '', array('clustering' => 'statelimitations'));
         $handler = eZExpiryHandler::instance();
         $storedTimeStamp = $handler->hasTimestamp('state-limitations') ? $handler->timestamp('state-limitations') : false;
         $expiryTime = $storedTimeStamp !== false ? $storedTimeStamp : 0;
         if ($phpCache->canRestore($expiryTime)) {
             $var = $phpCache->restore(array('state_limitations' => 'state_limitations'));
             $limitations = $var['state_limitations'];
         } else {
             $limitations = array();
             $groups = self::fetchByConditions(array("identifier NOT LIKE 'ez%'"), false, false);
             foreach ($groups as $group) {
                 $name = 'StateGroup_' . $group->attribute('identifier');
                 $limitations[$name] = array('name' => $name, 'values' => array(), 'class' => __CLASS__, 'function' => 'limitationValues', 'parameter' => array($group->attribute('id')));
             }
             $phpCache->addVariable('state_limitations', $limitations);
             $phpCache->store();
         }
         if ($storedTimeStamp === false) {
             $handler->setTimestamp('state-limitations', time());
         }
     }
     return $limitations;
 }
开发者ID:mugoweb,项目名称:ezpublish-legacy,代码行数:35,代码来源:ezcontentobjectstategroup.php

示例10: storeCache

 function storeCache($directory = false)
 {
     if (!file_exists($directory)) {
         eZDir::mkdir($directory, false, true);
     }
     $php = new eZPHPCreator($directory, 'package.php');
     $php->addComment("Automatically created cache file for the package format\n" . "Do not modify this file");
     $php->addSpace();
     $php->addVariable('CacheCodeDate', eZPackage::CACHE_CODE_DATE);
     $php->addSpace();
     $php->addVariable('Parameters', $this->Parameters, eZPHPCreator::VARIABLE_ASSIGNMENT, array('full-tree' => true));
     $php->addVariable('InstallData', $this->InstallData, eZPHPCreator::VARIABLE_ASSIGNMENT, array('full-tree' => true));
     $php->addVariable('RepositoryPath', $this->RepositoryPath);
     $php->store();
 }
开发者ID:jordanmanning,项目名称:ezpublish,代码行数:15,代码来源:ezpackage.php

示例11: storeCacheFile

 function storeCacheFile($filepath, $transformationData, $extraCode, $type, $charsetName)
 {
     $file = basename($filepath);
     $dir = dirname($filepath);
     $php = new eZPHPCreator($dir, $file);
     $php->addComment("Cached transformation data");
     $php->addComment("Type: {$type}");
     $php->addComment("Charset: {$charsetName}");
     $php->addComment("Cached transformation data");
     $php->addCodePiece('$data = ' . eZCharTransform::varExport($transformationData) . ";\n");
     $php->addCodePiece("\$text = strtr( \$text, \$data['table'] );\n");
     if ($extraCode) {
         $php->addCodePiece($extraCode);
     }
     return $php->store(true);
 }
开发者ID:ezsystems,项目名称:ezpublish-legacy,代码行数:16,代码来源:ezchartransform.php

示例12: storeCacheObject

 function storeCacheObject($filename, $permissionArray)
 {
     $dir = dirname($filename);
     $file = basename($filename);
     $php = new eZPHPCreator($dir, $file);
     $php->addVariable("umap", array());
     $php->addVariable("utf8map", array());
     $php->addVariable("cmap", array());
     $php->addVariable("utf8cmap", array());
     reset($this->UnicodeMap);
     while (($key = key($this->UnicodeMap)) !== null) {
         $item = $this->UnicodeMap[$key];
         $php->addVariable("umap[{$key}]", $item);
         next($this->UnicodeMap);
     }
     reset($this->UTF8Map);
     while (($key = key($this->UTF8Map)) !== null) {
         $item = $this->UTF8Map[$key];
         if ($item == 0) {
             $php->addCodePiece("\$utf8map[0] = chr(0);\n");
         } else {
             $val = str_replace(array("\\", "'"), array("\\\\", "\\'"), $item);
             $php->addVariable("utf8map[{$key}]", $val);
         }
         next($this->UTF8Map);
     }
     reset($this->CodeMap);
     while (($key = key($this->CodeMap)) !== null) {
         $item = $this->CodeMap[$key];
         $php->addVariable("cmap[{$key}]", $item);
         next($this->CodeMap);
     }
     reset($this->UTF8CodeMap);
     while (($key = key($this->UTF8CodeMap)) !== null) {
         $item = $this->UTF8CodeMap[$key];
         if ($item == 0) {
             $php->addVariable("utf8cmap[chr(0)]", 0);
         } else {
             $val = str_replace(array("\\", "'"), array("\\\\", "\\'"), $key);
             $php->addVariable("utf8cmap['{$val}']", $item);
         }
         next($this->UTF8CodeMap);
     }
     reset($this->ReadExtraMap);
     while (($key = key($this->ReadExtraMap)) !== null) {
         $item = $this->ReadExtraMap[$key];
         $php->addVariable("read_extra[{$key}]", $item);
         next($this->ReadExtraMap);
     }
     $php->addVariable("eZCodePageCacheCodeDate", self::CACHE_CODE_DATE);
     $php->addVariable("min_char", $this->MinCharValue);
     $php->addVariable("max_char", $this->MaxCharValue);
     $php->store(true);
     if (file_exists($filename)) {
         // Store the old umask and set a new one.
         $oldPermissionSetting = umask(0);
         // Change the permission setting.
         @chmod($filename, $permissionArray['file_permission']);
         // Restore the old umask.
         umask($oldPermissionSetting);
     }
 }
开发者ID:netbliss,项目名称:ezpublish,代码行数:62,代码来源:ezcodepage.php

示例13: classAttributeIdentifiersHash

 /**
  * Returns the class attribute identifier hash for the current database.
  * If it is outdated or non-existent, the method updates/generates the file
  *
  * @static
  * @since Version 4.1
  * @access protected
  * @return array Returns hash of classattributeidentifier => classattributeid
  */
 protected static function classAttributeIdentifiersHash()
 {
     if (self::$identifierHash === null) {
         $db = eZDB::instance();
         $dbName = md5($db->DB);
         $cacheDir = eZSys::cacheDirectory();
         $phpCache = new eZPHPCreator($cacheDir, 'classattributeidentifiers_' . $dbName . '.php', '', array('clustering' => 'classattridentifiers'));
         $handler = eZExpiryHandler::instance();
         $expiryTime = 0;
         if ($handler->hasTimestamp('class-identifier-cache')) {
             $expiryTime = $handler->timestamp('class-identifier-cache');
         }
         if ($phpCache->canRestore($expiryTime)) {
             $var = $phpCache->restore(array('identifierHash' => 'identifier_hash'));
             self::$identifierHash = $var['identifierHash'];
         } else {
             // Fetch identifier/id pair from db
             $query = "SELECT ezcontentclass_attribute.id as attribute_id, ezcontentclass_attribute.identifier as attribute_identifier, ezcontentclass.identifier as class_identifier\n                          FROM ezcontentclass_attribute, ezcontentclass\n                          WHERE ezcontentclass.id=ezcontentclass_attribute.contentclass_id";
             $identifierArray = $db->arrayQuery($query);
             self::$identifierHash = array();
             foreach ($identifierArray as $identifierRow) {
                 $combinedIdentifier = $identifierRow['class_identifier'] . '/' . $identifierRow['attribute_identifier'];
                 self::$identifierHash[$combinedIdentifier] = (int) $identifierRow['attribute_id'];
             }
             // Store identifier list to cache file
             $phpCache->addVariable('identifier_hash', self::$identifierHash);
             $phpCache->store();
         }
     }
     return self::$identifierHash;
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:40,代码来源:ezcontentclassattribute.php

示例14: registerExtensions


//.........这里部分代码省略.........
                     //We are about to activate a new extension which might need to load one ore more other extension (if we do not have a cached info about this)
                     $allExtensionsRegistered = $cache_hit;
                 }
             }
         }
         $this->rebuildIniOverrideArray($siteaccess, $isBasicLoad);
         if (!$allExtensionsRegistered) {
             $additional_lookups++;
         }
     }
     if (!$cache_hit) {
         if ($isBasicLoad) {
             eZDebug::writeNotice("Loaded all basic extensions in {$additional_lookups} additional lookups...", __METHOD__);
         } else {
             if ($is_virtual_load) {
                 eZDebug::writeNotice("Loaded all virtual siteaccess extensions in {$additional_lookups} additional lookups...", __METHOD__);
             } else {
                 eZDebug::writeNotice("Loaded all siteaccess extensions in {$additional_lookups} additional lookups...", __METHOD__);
             }
         }
     }
     if ($write_cache) {
         if ($isBasicLoad) {
             eZDebug::writeNotice("Storing basic extension load information into cache file '{$cacheFilePath}'...", __METHOD__);
         } else {
             if ($is_virtual_load) {
                 eZDebug::writeNotice("Storing virtual siteaccess extension load information into cache file '{$cacheFilePath}'...", __METHOD__);
             } else {
                 eZDebug::writeNotice("Storing siteaccess extension load information into cache file '{$cacheFilePath}'...", __METHOD__);
             }
         }
         $php = new eZPHPCreator($cacheDir, $cacheFileName);
         $php->addRawVariable($cache_var_name, $this->registeredExtensions);
         $php->store();
     }
     if ($is_virtual_load) {
         $this->virtualLoadingCompleted = true;
         eZDebug::accumulatorStop('OpenVolanoExtensionLoader_VirtualSiteaccess');
     } else {
         if (!$isBasicLoad) {
             $this->standardLoadingCompleted = true;
             $this->non_virtual_siteaccess_name = $siteaccess;
             eZDebug::accumulatorStop('OpenVolanoExtensionLoader_Siteaccess');
         } else {
             self::$earlyLoadingCompleted = true;
             eZDebug::accumulatorStop('OpenVolanoExtensionLoader_Basic');
         }
     }
     //Use the following line to take a look into the ini-hierarchy...
     //ymc_pr($GLOBALS["eZINIOverrideDirList"], $siteaccess.'|'.self::getCurrentSiteaccess());
     if (!$is_virtual_load and !$isBasicLoad and $ini->hasVariable('SiteAccessSettings', 'VirtualSiteaccessSystem') and $ini->variable('SiteAccessSettings', 'VirtualSiteaccessSystem') !== 'disabled') {
         $allowLoadingOfPreviouslyKnownSiteaccesses = false;
         if ($ini->hasVariable('SiteAccessSettings', 'VirtualSiteaccessSystem') and $ini->variable('VirtualSiteaccessSettings', 'AllowLoadingOfPerviouslyKnowSiteaccesses') === 'enabled') {
             $allowLoadingOfPreviouslyKnownSiteaccesses = true;
         }
         if (isset($GLOBALS['eZURIRequestInstance']) and is_object($GLOBALS['eZURIRequestInstance'])) {
             $uri = eZURI::instance();
             $elements = $uri->elements(false);
             if (count($elements) > 0 and $elements[0] != '') {
                 $goInVirtualSiteaccessMode = true;
                 if ($ini->hasVariable('VirtualSiteaccessSettings', 'SkipLoadingForUri') and is_array($ini->variable('VirtualSiteaccessSettings', 'SkipLoadingForUri')) and count($ini->variable('VirtualSiteaccessSettings', 'SkipLoadingForUri')) > 0) {
                     $uri_string = $uri->elements(true);
                     foreach ($ini->variable('VirtualSiteaccessSettings', 'SkipLoadingForUri') as $ignoreUriForVirtualSiteaccess) {
                         if (strpos($uri_string, $ignoreUriForVirtualSiteaccess) === 0) {
                             $goInVirtualSiteaccessMode = false;
                             break;
开发者ID:pascalvb,项目名称:eZ-ExtensionLoader,代码行数:67,代码来源:ymcextensionloader.php


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