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


PHP Zend_Config::setReadOnly方法代码示例

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


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

示例1: _initConfig

 /**
  * Combine the static info found in application.ini with the
  * dynamic info found in the Info table.
  *
  * @return void
  */
 protected function _initConfig()
 {
     $this->bootstrap('db');
     $this->bootstrap('locale');
     if (!class_exists('Model_Info')) {
         return;
     }
     try {
         $staticConfig = Zend_Registry::get('config');
         $infoModel = $this->_getInfoModel();
         $dynamicConfig = $infoModel->fetchAsConfig(null, APPLICATION_ENV);
         // Very sneakily bypass 'readOnly'
         if ($staticConfig->readOnly()) {
             $staticConfig = new Zend_Config($staticConfig->toArray(), APPLICATION_ENV, true);
         }
         $staticConfig->merge($dynamicConfig);
         $staticConfig->setReadOnly();
         Zend_Registry::set('config', $staticConfig);
     } catch (Exception $e) {
         $msg = $e->getMessage();
         if (strpos($msg, 'Unknown database') === false && strpos($msg, "doesn't exist") === false) {
             throw $e;
         }
     }
 }
开发者ID:grrr-amsterdam,项目名称:garp3,代码行数:31,代码来源:Bootstrap.php

示例2: setQuotaModuleEnableDev

 /**
  * @param boolean $enableDev
  */
 protected function setQuotaModuleEnableDev($enableDev)
 {
     $config = Registry::getConfig();
     $newConfig = new \Zend_Config($config->toArray(), true);
     $newConfig->quota->module->enableDev = $enableDev;
     $newConfig->setReadOnly();
     Registry::setConfig($newConfig);
 }
开发者ID:rukzuk,项目名称:rukzuk,代码行数:11,代码来源:AbstractImportQuotaTestCase.php

示例3: _initConfig

 public function _initConfig()
 {
     $config = new Zend_Config($this->getOptions(), true);
     $inifiles = array('app', 'cache', 'private');
     //TODO: only load cache.ini for models
     foreach ($inifiles as $file) {
         $inifile = APPLICATION_PATH . "/configs/{$file}.ini";
         if (is_readable($inifile)) {
             $config->merge(new Zend_Config_Ini($inifile));
         }
     }
     $config->setReadOnly();
     $this->setOptions($config->toArray());
     Zend_Registry::set('config', $config);
     define('DATE_DB', 'Y-m-d H:i:s');
 }
开发者ID:josmel,项目名称:DevelEntretenimientoEntel,代码行数:16,代码来源:Bootstrap.php

示例4: init

 /**
  * Load both config files.
  *
  * @return Zend_Config
  */
 public function init()
 {
     $mainConfig = $this->_coreResource->init();
     $testConfigPath = APP_DIR . '/tests/config.ini';
     $config = new Zend_Config_Ini($testConfigPath);
     if (!Zend_Registry::isRegistered('test_config')) {
         Zend_Registry::set('test_config', $config->testing);
     }
     // Merging the configs allows us to override settings only for tests.
     if ($config->site instanceof Zend_Config) {
         $mainCopy = new Zend_Config($mainConfig->toArray(), true);
         $mainCopy->merge($config->site);
         $mainCopy->setReadOnly(true);
         $mainConfig = $mainCopy;
     }
     return $mainConfig;
 }
开发者ID:lchen01,项目名称:STEdwards,代码行数:22,代码来源:Config.php

示例5: testSetReadOnly

 /**
  * ensure that modification is not allowed after calling setReadOnly()
  *
  */
 public function testSetReadOnly()
 {
     $configData = array('a' => 'a');
     $config = new Zend_Config($configData, true);
     $config->b = 'b';
     $config->setReadOnly();
     try {
         $config->c = 'c';
     } catch (Zend_Config_Exception $expected) {
         $this->assertContains('is read only', $expected->getMessage());
         return;
     }
     $this->fail('Expected read only exception has not been raised.');
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:18,代码来源:ConfigTest.php

示例6: testSetReadOnlyAppliesToChildren

 /**
  * @group ZF-4728
  *
  */
 public function testSetReadOnlyAppliesToChildren()
 {
     $config = new Zend_Config($this->_all, true);
     $config->setReadOnly();
     $this->assertTrue($config->readOnly());
     $this->assertTrue($config->one->readOnly(), 'First level children are writable');
     $this->assertTrue($config->one->two->readOnly(), 'Second level children are writable');
 }
开发者ID:SustainableCoastlines,项目名称:loveyourwater,代码行数:12,代码来源:ConfigTest.php

示例7: foreach

    if (isset($arr['zend']['zend_path'])) {
        $zenddir = $arr['zend']['zend_path'];
    }
}
// Setup include path
//add zend directory to include path
set_include_path(get_include_path() . PATH_SEPARATOR . $zenddir);
// Initialize Zend Framework loader
require_once 'Zend/Loader/Autoloader.php';
// require_once 'services/Pdoconfig.php';
// require_once 'services/UserModel.php';
Zend_Loader_Autoloader::getInstance();
// Load configuration
$default_config = new Zend_Config(array("production" => false), true);
$default_config->merge(new Zend_Config_Ini($configfile, 'zendamf'));
$default_config->setReadOnly();
$amf = $default_config->amf;
// Store configuration in the registry
Zend_Registry::set("amf-config", $amf);
// Initialize AMF Server
$server = new Zend_Amf_Server();
$server->setProduction($amf->production);
if (isset($amf->directories)) {
    $dirs = $amf->directories->toArray();
    foreach ($dirs as $dir) {
        // get the first character of the path.
        // If it does not start with slash then it implies that the path is relative to webroot. Else it will be treated as absolute path
        $length = strlen($dir);
        $firstChar = $dir;
        if ($length >= 1) {
            $firstChar = $dir[0];
开发者ID:limweb,项目名称:webappservice,代码行数:31,代码来源:gateway.php

示例8: removeValue

 /**
  * @param array $pathToValue
  */
 public static function removeValue(array $pathToValue)
 {
     $config = Registry::getConfig()->toArray();
     if (count($pathToValue) <= 0) {
         $config = array();
     } else {
         $configPart =& $config;
         foreach (array_slice($pathToValue, 0, -1) as $key) {
             if (!array_key_exists($key, $configPart)) {
                 return;
             }
             $configPart =& $configPart[$key];
         }
         unset($configPart[end($pathToValue)]);
     }
     $newConfig = new \Zend_Config($config, true);
     $newConfig->setReadOnly();
     Registry::setConfig($newConfig);
 }
开发者ID:rukzuk,项目名称:rukzuk,代码行数:22,代码来源:ConfigHelper.php


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