本文整理汇总了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;
}
示例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'));
}
示例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;
}
示例4: _cleanCache
/**
* Cleaning cache
*
* @param string $tag
*/
protected function _cleanCache($tag)
{
if ($this->_factory->getHelper('rss')->isRssEnabled()) {
$this->_app->cleanCache(array($tag));
}
}
示例5: _saveAdvanced
/**
* Advanced save procedure
*/
protected function _saveAdvanced()
{
$this->_app->cleanCache(array('layout', Mage_Core_Model_Layout_Merge::LAYOUT_GENERAL_CACHE_TAG));
}
示例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;
}