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


PHP Zend_Application::_loadConfig方法代码示例

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


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

示例1: _loadConfig

 /**
  * Load configuration file of options
  *
  * @param string $file configuration file
  *
  * @throws Zend_Application_Exception When invalid configuration file is provided
  *
  * @return array
  */
 protected function _loadConfig($file)
 {
     if ($this->isFileUpToDate($file) && ($config = $this->getConfigFromCache())) {
         return $config;
     }
     return $this->storeConfigInCache(parent::_loadConfig($file));
 }
开发者ID:JellyBellyDev,项目名称:zle,代码行数:16,代码来源:Application.php

示例2: _loadConfig

    /**
     * Creates and caches Zend_Config. This can't be done in the bootstrap
     * because the application requires a configuration in order to be
     * created.
     *
     * @param   string      Config file
     * @return  array
     */
    protected function _loadConfig($file)
    {
        $frontendOptions = array(
            'automatic_serialization'   => true,
            'master_file'               => $file,
            'cache_id_prefix'           => APPLICATION_ENV
        );

        if (extension_loaded('apc')) {
            $cache = Zend_Cache::factory('File', 'Apc', $frontendOptions);
        } else {
            $cache = Zend_Cache::factory('File', 'File', $frontendOptions, array(
                'cache_dir'     => PROJECT_BASE_PATH . '/cache',
                'file_locking'  => true
            ));
        }

        if (APPLICATION_ENV != 'production' || (!$config = $cache->load('config'))) {
            $config = parent::_loadConfig($file);

            // Initialize WordPress configuration values
            $config = $this->_initWordPress($config);

            if (APPLICATION_ENV == 'production') {
                $cache->save($config, 'config');
            }
        }

        // Save for bootstrapping
        Zend_Registry::set('config', $obj = new Zend_Config($config));

        return $config;
    }
开发者ID:RemiWoler,项目名称:vulnero,代码行数:41,代码来源:Application.php

示例3: _loadConfig

 /**
  * Load configuration file of options.
  *
  * Optionally will cache the configuration.
  *
  * @param  string $file
  * @throws Zend_Application_Exception When invalid configuration file is provided
  * @return array
  */
 protected function _loadConfig($file)
 {
     $suffix = pathinfo($file, PATHINFO_EXTENSION);
     $suffix = $suffix === 'dist' ? pathinfo(basename($file, ".{$suffix}"), PATHINFO_EXTENSION) : $suffix;
     if ($suffix == 'ini') {
         $config = Garp_Config_Ini::getCached($file, $this->getEnvironment())->toArray();
     } else {
         $config = parent::_loadConfig($file);
     }
     return $config;
 }
开发者ID:grrr-amsterdam,项目名称:garp3,代码行数:20,代码来源:Application.php

示例4: _loadConfig

 /**
  * Load configuration file of options.
  *
  * Optionally will cache the configuration.
  *
  * @param  string $file
  * @throws Zend_Application_Exception When invalid configuration file is provided
  * @return array
  */
 protected function _loadConfig($file)
 {
     if (!$this->_cacheConfig) {
         return parent::_loadConfig($file);
     }
     require_once 'Zend/Cache.php';
     $cache = Zend_Cache::factory($this->_cacheOptions['frontendType'], $this->_cacheOptions['backendType'], array_merge(array('master_file' => $file, 'automatic_serialization' => true), $this->_cacheOptions['frontendOptions']), array_merge(array('cache_dir' => APPLICATION_PATH . '/../data/cache'), $this->_cacheOptions['backendOptions']));
     $config = $cache->load('Zend_Application_Config');
     if (!$config) {
         $config = parent::_loadConfig($file);
         $cache->save($config, 'Zend_Application_Config');
     }
     return $config;
 }
开发者ID:hukumonline,项目名称:pmg,代码行数:23,代码来源:ZP.php

示例5: _loadConfig

 protected function _loadConfig($file)
 {
     $filename = str_replace('ini', 'php', basename($file));
     $path = APPLICATION_PATH . '/../data/cache/' . $filename;
     if (file_exists($path)) {
         return require $path;
     }
     $config = parent::_loadConfig($file);
     if (isset($config['resources']['cachemanager']['default']['active']) && $config['resources']['cachemanager']['default']['active'] || $this->_cacheEnabled) {
         $this->_cacheEnabled = true;
         $arrayString = "<?php\n return " . var_export($config, true) . ";\n";
         file_put_contents($path, $arrayString);
     }
     return $config;
 }
开发者ID:abdala,项目名称:la,代码行数:15,代码来源:Application.php

示例6: _loadConfig

 protected function _loadConfig($file)
 {
     if ($this->_useCache == false) {
         return parent::_loadConfig($file);
     }
     $configMTime = filemtime($file);
     $cacheId = "application_conf_" . md5($file . $this->getEnvironment());
     $cacheLastMTime = $this->_configCache->test($cacheId);
     //Valid cache?
     if ($cacheLastMTime !== false && $configMTime <= $cacheLastMTime) {
         return $this->_configCache->load($cacheId, true);
     }
     $config = parent::_loadConfig($file);
     $this->_configCache->save($config, $cacheId, array(), null);
     return $config;
 }
开发者ID:henvic,项目名称:MediaLab,代码行数:16,代码来源:Application.php

示例7: _loadConfig

 /**
  * Loads the configuration file from either cache or file
  *
  * @param string $file
  * @return array
  */
 protected function _loadConfig($file)
 {
     if (isset($this->_cacheOptions['enabled']) && false === $this->_cacheOptions['enabled']) {
         return parent::_loadConfig($file);
     }
     $frontendType = isset($this->_cacheOptions['frontendType']) ? $this->_cacheOptions['frontendType'] : 'File';
     $backendType = isset($this->_cacheOptions['backendType']) ? $this->_cacheOptions['backendType'] : 'File';
     $frontendOptions = isset($this->_cacheOptions['frontendOptions']) ? $this->_cacheOptions['frontendOptions'] : array();
     $backendOptions = isset($this->_cacheOptions['backendOptions']) ? $this->_cacheOptions['backendOptions'] : array();
     require_once 'Zend/Cache.php';
     $cache = Zend_Cache::factory($frontendType, $backendType, array_merge(array('master_file' => $file, 'automatic_serialization' => true), $frontendOptions), array_merge(array('cache_dir' => sys_get_temp_dir()), $backendOptions));
     $config = $cache->load('Zend_Application_Config');
     if (!$config) {
         $config = parent::_loadConfig($file);
         $cache->save($config, 'Zend_Application_Config');
     }
     return $config;
 }
开发者ID:robzienert,项目名称:Drake,代码行数:24,代码来源:Application.php

示例8: _loadConfig

 /**
  * @param string $file
  * @param bool $fromDefault
  * @return Zend_Config
  * @author Se#
  * @version 0.0.1
  */
 protected function _loadConfig($file, $fromDefault = false)
 {
     // define is default config need
     $default = $fromDefault ? false : $this->_defaultConfig();
     $suffix = strtolower(pathinfo($file, PATHINFO_EXTENSION));
     if ($this->_configCache === null || $suffix == 'php' || $suffix == 'inc') {
         //No need for caching those
         return $default ? $this->_mergeConfigs($default, parent::_loadConfig($file)) : parent::_loadConfig($file);
     }
     $configMTime = filemtime($file);
     $cacheId = $this->_cacheId($file);
     $cacheLastMTime = $this->_configCache->test($cacheId);
     if ($cacheLastMTime !== false && $configMTime < $cacheLastMTime) {
         //Valid cache?
         return $this->_configCache->load($cacheId, true);
     } else {
         $config = parent::_loadConfig($file);
         $this->_configCache->save($config, $cacheId, array(), null);
         return $default ? $this->_mergeConfigs($default, $config) : $config;
     }
 }
开发者ID:nurikk,项目名称:EvilRocketFramework,代码行数:28,代码来源:Application.php


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