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


PHP Mage_Core_Model_Config::reinit方法代码示例

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


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

示例1: indexAction

 /**
  * Save configuration
  */
 public function indexAction()
 {
     try {
         if (false == $this->_isSectionAllowed($this->getRequest()->getParam('section'))) {
             throw new Exception($this->_getHelper()->__('This section is not allowed.'));
         }
         // custom save logic
         $this->_saveSection();
         $section = $this->getRequest()->getParam('section');
         $website = $this->getRequest()->getParam('website');
         $store = $this->getRequest()->getParam('store');
         $configData = array('section' => $section, 'website' => $website, 'store' => $store, 'groups' => $this->_getGroupsForSave());
         /** @var Mage_Backend_Model_Config $configModel  */
         $configModel = $this->_configFactory->create(array('data' => $configData));
         $configModel->save();
         // re-init configuration
         $this->_configModel->reinit();
         $this->_eventManager->dispatch('admin_system_config_section_save_after', array('website' => $website, 'store' => $store, 'section' => $section));
         $this->_app->reinitStores();
         // website and store codes can be used in event implementation, so set them as well
         $this->_eventManager->dispatch("admin_system_config_changed_section_{$section}", array('website' => $website, 'store' => $store));
         $this->_session->addSuccess($this->_getHelper()->__('The configuration has been saved.'));
     } catch (Mage_Core_Exception $e) {
         $messages = explode("\n", $e->getMessage());
         foreach ($messages as $message) {
             $this->_session->addError($message);
         }
     } catch (Exception $e) {
         $this->_session->addException($e, $this->_getHelper()->__('An error occurred while saving this configuration:') . ' ' . $e->getMessage());
     }
     $this->_saveState($this->getRequest()->getPost('config_state'));
     $this->_redirect('*/system_config/edit', array('_current' => array('section', 'website', 'store')));
 }
开发者ID:,项目名称:,代码行数:36,代码来源:

示例2: reinit

 /**
  * Reinitialize configuration. Instead of doing the actual reinitialization
  * we mark the cache as invalidated and set a timestamp that is later
  * matched with a cron scheduled config cache regenerator timestamp.
  *
  * @param   array $options
  * @return  Mage_Core_Model_Config
  */
 public function reinit($options = array())
 {
     $backend = Mage::app()->getCacheInstance()->getFrontend()->getBackend();
     if (get_class($backend) !== 'Made_Cache_Redis_Backend') {
         return parent::reinit($options);
     }
     if (in_array(self::SAVE_KEY, $options)) {
         // Mark the config cache as valid before we lock to prevent an
         // invalidate-regenerate race condition
         $cache = Mage::app()->getCacheInstance();
         $types = $cache->load(Mage_Core_Model_Cache::INVALIDATED_TYPES);
         if ($types) {
             $types = unserialize($types);
             if (isset($types[strtolower(self::CACHE_TAG)])) {
                 unset($types[strtolower(self::CACHE_TAG)]);
             }
             $cache->save(serialize($types), Mage_Core_Model_Cache::INVALIDATED_TYPES);
         }
         // If we got called by our observer, pass it on with a single
         // instance lock.
         $options = $this->getLockingOptions();
         if ($backend->acquireLock($options['lock_name'], $options['token'], $options['lock_timeout'])) {
             $this->_allowCacheForInit = false;
             $this->_useCache = false;
             $options['lock_acquired'] = true;
             $this->init($options);
             $backend->releaseLock($options['lock_name'], $options['token']);
         }
     } else {
         // Instead of reinitializing the cache, simply mark the config
         // cache as invalidated.
         Mage::app()->getCacheInstance()->invalidateType(strtolower(self::CACHE_TAG));
     }
     return $this;
 }
开发者ID:eneiasramos,项目名称:Made_Cache,代码行数:43,代码来源:Config.php


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