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


PHP Mage_Core_Model_App::cleanCache方法代码示例

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


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

示例1: assignThemeToStores

 /**
  * Assign theme to the stores
  *
  * @param int $themeId
  * @param array $stores
  * @param string $scope
  * @param string $area
  * @return Mage_Core_Model_Theme
  * @throws UnexpectedValueException
  */
 public function assignThemeToStores($themeId, array $stores = array(), $scope = Mage_Core_Model_Config::SCOPE_STORES, $area = Mage_Core_Model_App_Area::AREA_FRONTEND)
 {
     /** @var $theme Mage_Core_Model_Theme */
     $theme = $this->_themeFactory->create()->load($themeId);
     if (!$theme->getId()) {
         throw new UnexpectedValueException('Theme is not recognized. Requested id: ' . $themeId);
     }
     $themeCustomization = $theme->isVirtual() ? $theme : $this->createThemeCustomization($theme);
     $configPath = $this->_design->getConfigPathByArea($area);
     // Unassign given theme from stores that were unchecked
     /** @var $config Mage_Core_Model_Config_Data */
     foreach ($this->_getAssignedScopesCollection($scope, $configPath) as $config) {
         if ($config->getValue() == $themeId && !in_array($config->getScopeId(), $stores)) {
             $this->_app->getConfig()->deleteConfig($configPath, $scope, $config->getScopeId());
         }
     }
     if (count($stores) > 0) {
         foreach ($stores as $storeId) {
             $this->_app->getConfig()->saveConfig($configPath, $themeCustomization->getId(), $scope, $storeId);
         }
         $this->_app->cleanCache(Mage_Core_Model_Config::CACHE_TAG);
     }
     $this->_makeTemporaryLayoutUpdatesPermanent($themeId, $stores);
     $this->_app->cleanCache(array('layout', Mage_Core_Model_Layout_Merge::LAYOUT_GENERAL_CACHE_TAG));
     $this->_eventManager->dispatch('assign_theme_to_stores_after', array('themeService' => $this, 'themeId' => $themeId, 'stores' => $stores, 'scope' => $scope, 'area' => $area, 'theme' => $theme, 'themeCustomization' => $themeCustomization));
     return $themeCustomization;
 }
开发者ID:,项目名称:,代码行数:37,代码来源:

示例2: testCleanCache

 public function testCleanCache()
 {
     $this->assertEmpty($this->_mageModel->loadCache('test_id'));
     $this->_mageModel->saveCache('test_data', 'test_id', array('test_tag'));
     $this->assertEquals('test_data', $this->_mageModel->loadCache('test_id'));
     $this->_mageModel->cleanCache(array('test_tag'));
     $this->assertEmpty($this->_mageModel->loadCache('test_id'));
 }
开发者ID:nemphys,项目名称:magento2,代码行数:8,代码来源:AppTest.php

示例3: install

 /**
  * Install Magento
  *
  * @return boolean
  */
 public function install()
 {
     try {
         /**
          * Check if already installed
          */
         if (Mage::isInstalled()) {
             $this->addError('ERROR: Magento is already installed');
             return false;
         }
         /**
          * Skip URL validation, if set
          */
         $this->_getDataModel()->setSkipUrlValidation($this->_args['skip_url_validation']);
         $this->_getDataModel()->setSkipBaseUrlValidation($this->_args['skip_url_validation']);
         /**
          * Prepare data
          */
         $this->_prepareData();
         if ($this->hasErrors()) {
             return false;
         }
         $installer = $this->_getInstaller();
         /**
          * Install configuration
          */
         $installer->installConfig($this->_getDataModel()->getConfigData());
         if ($this->hasErrors()) {
             return false;
         }
         /**
          * Reinitialize configuration (to use new config data)
          */
         $this->_app->cleanCache();
         Mage::getConfig()->reinit();
         /**
          * Install database
          */
         $installer->installDb();
         if ($this->hasErrors()) {
             return false;
         }
         // apply data updates
         Mage_Core_Model_Resource_Setup::applyAllDataUpdates();
         /**
          * Validate entered data for administrator user
          */
         $user = $installer->validateAndPrepareAdministrator($this->_getDataModel()->getAdminData());
         if ($this->hasErrors()) {
             return false;
         }
         /**
          * Prepare encryption key and validate it
          */
         $encryptionKey = empty($this->_args['encryption_key']) ? md5(Mage::helper('core')->getRandomString(10)) : $this->_args['encryption_key'];
         $this->_getDataModel()->setEncryptionKey($encryptionKey);
         $installer->validateEncryptionKey($encryptionKey);
         if ($this->hasErrors()) {
             return false;
         }
         /**
          * Create primary administrator user
          */
         $installer->createAdministrator($user);
         if ($this->hasErrors()) {
             return false;
         }
         /**
          * Save encryption key or create if empty
          */
         $installer->installEnryptionKey($encryptionKey);
         if ($this->hasErrors()) {
             return false;
         }
         /**
          * Installation finish
          */
         $installer->finish();
         if ($this->hasErrors()) {
             return false;
         }
         /**
          * Change directories mode to be writable by apache user
          */
         @chmod('var/cache', 0777);
         @chmod('var/session', 0777);
     } catch (Exception $e) {
         $this->addError('ERROR: ' . $e->getMessage());
         return false;
     }
     return true;
 }
开发者ID:okite11,项目名称:frames21,代码行数:97,代码来源:Console.php

示例4: _cleanCache

 /**
  * Cleaning cache
  *
  * @param string $tag
  */
 protected function _cleanCache($tag)
 {
     if ($this->_factory->getHelper('rss')->isRssEnabled()) {
         $this->_app->cleanCache(array($tag));
     }
 }
开发者ID:hyhoocchan,项目名称:mage-local,代码行数:11,代码来源:Observer.php

示例5: _saveAdvanced

 /**
  * Advanced save procedure
  */
 protected function _saveAdvanced()
 {
     $this->_app->cleanCache(array('layout', Mage_Core_Model_Layout_Merge::LAYOUT_GENERAL_CACHE_TAG));
 }
开发者ID:,项目名称:,代码行数:7,代码来源:

示例6: install

 /**
  * Install Magento
  *
  * @return boolean
  */
 public function install()
 {
     try {
         /**
          * Check if already installed
          */
         if (AO::isInstalled()) {
             $this->addError('ERROR: Magento is already installed');
             return false;
         }
         /**
          * Skip URL validation, if set
          */
         $this->_getDataModel()->setSkipUrlValidation($this->_args['skip_url_validation']);
         $this->_getDataModel()->setSkipBaseUrlValidation($this->_args['skip_url_validation']);
         /**
          * Prepare data
          */
         $this->_prepareData();
         if ($this->hasErrors()) {
             return false;
         }
         $installer = $this->_getInstaller();
         /**
          * Install configuration
          */
         $installer->installConfig($this->_getDataModel()->getConfigData());
         // TODO fix wizard and simplify this everythere
         if ($this->hasErrors()) {
             return false;
         }
         /**
          * Reinitialize configuration (to use new config data)
          */
         $this->_app->cleanCache();
         AO::getConfig()->reinit();
         /**
          * Install database
          */
         $installer->installDb();
         if ($this->hasErrors()) {
             return false;
         }
         /**
          * Create primary administrator user
          */
         $installer->createAdministrator($this->_getDataModel()->getAdminData());
         if ($this->hasErrors()) {
             return false;
         }
         /**
          * Save encryption key or create if empty
          */
         $encryptionKey = empty($this->_args['encryption_key']) ? md5(time()) : $this->_args['encryption_key'];
         $this->_getDataModel()->setEncryptionKey($encryptionKey);
         $installer->installEnryptionKey($encryptionKey);
         if ($this->hasErrors()) {
             return false;
         }
         /**
          * Installation finish
          */
         $installer->finish();
         if ($this->hasErrors()) {
             return false;
         }
         /**
          * Change directories mode to be writable by apache user
          */
         @chmod('var/cache', 0777);
         @chmod('var/session', 0777);
     } catch (Exception $e) {
         $this->addError('ERROR: ' . $e->getMessage());
         return false;
     }
     return true;
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:82,代码来源:Installer_Console.php


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