0

我有一个站点,我在 magento 中运行多个商店,并且需要在每个商店级别禁用模块。

Magento的第二个答案:禁用任何特定商店的模块确实有效,但是需要关闭布局缓存。这似乎大大增加了服务器负载。

我发现了 alan Storm 的这篇文章,这似乎很有帮助http://alanstorm.com/magento_config_a_critique_and_caching

有没有一种方法可以去除特定的 xml 片段,即使它是从缓存中加载的?

无论如何实现,这似乎都会很麻烦,但是大多数扩展编写者在构建扩展时似乎没有考虑到多网站/商店。如果能够完全禁用每个商店的模块并仍然允许布局缓存正常运行,那就太好了。

4

1 回答 1

0

好的,所以我想我想出了这个。

在 /app/code/local/Mage/Core/Model/Config.php (原件副本)。

   public function loadModulesCache()
{
    if (Mage::isInstalled(array('etc_dir' => $this->getOptions()->getEtcDir()))) {
        if ($this->_canUseCacheForInit()) {
            Varien_Profiler::start('mage::app::init::config::load_cache');
            $loaded = $this->loadCache();
            Varien_Profiler::stop('mage::app::init::config::load_cache');
            if ($loaded) {


               ***PUT CODE HERE TO EDIT $this->_xml***
               Just remove the nodes which should be disabled.


                $this->_useCache = true;
                return true;
            }
        }
    }
    return false;
}

我不知道这是否是最好的方法,或者是否应该这样做,但我现在要测试一下,看看是否会弹出任何其他错误

于 2012-08-09T17:51:03.660 回答