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


PHP Mage_Core_Model_Config::init方法代码示例

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


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

示例1: init

 /**
  * Initialize application
  *
  * @param string $code
  * @param string $type
  * @param string $etcDir
  * @return Mage_Core_Model_App
  */
 public function init($code, $type, $etcDir)
 {
     Varien_Profiler::start('app/construct');
     $this->setErrorHandler(self::DEFAULT_ERROR_HANDLER);
     date_default_timezone_set(Mage_Core_Model_Locale::DEFAULT_TIMEZONE);
     //        if ($type==='store') {
     //            $this->_currentStore = $code;
     //        }
     $this->_config = Mage::getConfig();
     $this->_config->init($etcDir);
     if ($this->isInstalled()) {
         $this->_initStores();
         switch ($type) {
             case 'store':
                 $this->_currentStore = $code;
                 break;
             case 'group':
                 $this->_currentStore = $this->_getStoreByGroup($code);
                 break;
             case 'website':
                 $this->_currentStore = $this->_getStoreByWebsite($code);
                 break;
             default:
                 Mage::throwException('Invalid Type! Allowed types: website, group, store');
         }
         $this->_checkCookieStore($type);
         $this->_checkGetStore($type);
     }
     Varien_Profiler::stop('app/construct');
     return $this;
 }
开发者ID:arslbbt,项目名称:mangentovies,代码行数:39,代码来源:App.php

示例2: init

 /**
  * Initialization of core configuration
  *
  * @return Mage_Core_Model_Config
  */
 public function init($options = array())
 {
     $backend = Mage::app()->getCacheInstance()->getFrontend()->getBackend();
     if (get_class($backend) !== 'Made_Cache_Redis_Backend') {
         return parent::init($options);
     }
     $this->setCacheChecksum(null);
     $this->_cacheLoadedSections = array();
     $this->setOptions($options);
     $this->loadBase();
     $cacheLoad = $this->loadModulesCache();
     if ($cacheLoad) {
         return $this;
     }
     $lockingOptions = $this->getLockingOptions();
     $lockSpun = false;
     if (empty($options['lock_acquired'])) {
         // Spin lock
         while (!$backend->acquireLock($lockingOptions['lock_name'], $lockingOptions['token'], $lockingOptions['lock_timeout'])) {
             $lockSpun = true;
             usleep($lockingOptions['spin_timeout']);
         }
     }
     if ($lockSpun) {
         // The cache might have been generated while we waited for the lock
         $cacheLoad = $this->loadModulesCache();
         if ($cacheLoad) {
             $backend->releaseLock($lockingOptions['lock_name'], $lockingOptions['token']);
             return $this;
         }
     }
     // Check cache
     // @see https://github.com/convenient/magento-ce-ee-config-corruption-bug#the-fix
     $this->_useCache = false;
     // </iterations fix>
     $this->loadModules();
     $this->loadDb();
     $this->saveCache();
     if (empty($options['lock_acquired'])) {
         $backend->releaseLock($lockingOptions['lock_name'], $lockingOptions['token']);
     }
     return $this;
 }
开发者ID:eneiasramos,项目名称:Made_Cache,代码行数:48,代码来源:Config.php

示例3: init

 /**
  * Initialize application without request processing
  *
  * @param  string|array $code
  * @param  string $type
  * @param  string|array $options
  * @return Mage_Core_Model_App
  */
 public function init($code, $type = null, $options = array())
 {
     $this->_initEnvironment();
     if (is_string($options)) {
         $options = array('etc_dir' => $options);
     }
     Varien_Profiler::start('mage::app::init::config');
     $this->_config = Mage::getConfig();
     $this->_config->setOptions($options);
     $this->_initBaseConfig();
     $this->_initCache();
     $this->_config->init($options);
     Varien_Profiler::stop('mage::app::init::config');
     if ($this->_isInstalled === null) {
         $this->_isInstalled = Mage::isInstalled($options);
     }
     if ($this->_isInstalled) {
         $this->_initCurrentStore($code, $type);
         $this->_initRequest();
     }
     return $this;
 }
开发者ID:mswebdesign,项目名称:Mswebdesign_Magento_1_Community_Edition,代码行数:30,代码来源:App.php

示例4: init

 /**
  * Initialize application
  *
  * @param string|array $code
  * @param string $type
  * @param string $etcDir
  * @return Mage_Core_Model_App
  */
 public function init($code, $type = null, $options = array())
 {
     $this->setErrorHandler(self::DEFAULT_ERROR_HANDLER);
     date_default_timezone_set(Mage_Core_Model_Locale::DEFAULT_TIMEZONE);
     if (is_string($options)) {
         $options = array('etc_dir' => $options);
     }
     Varien_Profiler::start('mage::app::init::config');
     $this->_config = Mage::getConfig();
     $this->_config->init($options);
     Varien_Profiler::stop('mage::app::init::config');
     if (Mage::isInstalled($options)) {
         Varien_Profiler::start('mage::app::init::stores');
         $this->_initStores();
         Varien_Profiler::stop('mage::app::init::stores');
         if (empty($code) && !is_null($this->_website)) {
             $code = $this->_website->getCode();
             $type = 'website';
         }
         switch ($type) {
             case 'store':
                 $this->_currentStore = $code;
                 break;
             case 'group':
                 $this->_currentStore = $this->_getStoreByGroup($code);
                 break;
             case 'website':
                 $this->_currentStore = $this->_getStoreByWebsite($code);
                 break;
             default:
                 $this->throwStoreException();
         }
         if (!empty($this->_currentStore)) {
             $this->_checkCookieStore($type);
             $this->_checkGetStore($type);
         }
         $this->getRequest()->setPathInfo();
     }
     return $this;
 }
开发者ID:jauderho,项目名称:magento-mirror,代码行数:48,代码来源:App.php

示例5: setUp

 public function setUp()
 {
     $this->_model = new Mage_Core_Model_Config();
     $this->_model->init(self::$_options);
 }
开发者ID:nemphys,项目名称:magento2,代码行数:5,代码来源:ConfigFactoryTest.php

示例6: _createModel

 /**
  * Instantiate Mage_Core_Model_Config and initialize (load configuration) if needed
  *
  * @param bool $initialize
  * @return Mage_Core_Model_Config
  */
 protected function _createModel($initialize = false)
 {
     $model = new Mage_Core_Model_Config();
     if ($initialize) {
         $model->init(self::$_options);
     }
     return $model;
 }
开发者ID:relue,项目名称:magento2,代码行数:14,代码来源:ConfigTest.php

示例7: init

 /**
  * Initialize application without request processing
  *
  * @param  string|array $code
  * @param  string $type
  * @param  string|array $options
  * @return Mage_Core_Model_App
  */
 public function init($code, $type = null, $options = array())
 {
     $this->_initEnvironment();
     if (is_string($options)) {
         $options = array('etc_dir' => $options);
     }
     Magento_Profiler::start('init_config');
     $this->_config = Mage::getConfig();
     $this->_config->setOptions($options);
     $this->_initBaseConfig();
     $logger = $this->_initLogger();
     $this->_initCache();
     $this->_config->init($options);
     $this->loadAreaPart(Mage_Core_Model_App_Area::AREA_GLOBAL, Mage_Core_Model_App_Area::PART_EVENTS);
     $this->loadDiConfiguration();
     Magento_Profiler::stop('init_config');
     if (Mage::isInstalled($options)) {
         $this->_initCurrentStore($code, $type);
         $logger->initForStore($this->_store);
         $this->_initRequest();
     }
     return $this;
 }
开发者ID:natxetee,项目名称:magento2,代码行数:31,代码来源:App.php

示例8: setUp

 public function setUp()
 {
     $this->_model = Mage::getModel('Mage_Core_Model_Config');
     $this->_model->init(self::$_options);
 }
开发者ID:natxetee,项目名称:magento2,代码行数:5,代码来源:ConfigFactoryTest.php


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