2012-08-09 23 views
0

我在那裏,我的Magento內運行多個門店,需要在每家商店的級別禁用模塊的網站。從配置中刪除一個模塊,即使其緩存

這裏的第二個答案Magento: Disable module for any particular store確實有效,但是佈局緩存需要關閉。這似乎大大增加了服務器負載。

我發現這篇文章由阿蘭風暴這似乎是這將有助於http://alanstorm.com/magento_config_a_critique_and_caching

有沒有一種方法,我可以剝奪,即使它被從緩存中加載的XML的特定的作品呢?

這似乎是它會哈克不管它是如何實現的,而大部分的擴展名作家似乎並沒有建立自己的擴展時採取多網站/店進去。能夠完全禁用每個商店的模塊並且仍然允許佈局高速緩存正常運行將會很好。

回答

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; 
} 

我不知道如果這是最好的方式,如果這甚至應該做的,但我現在要測試,看看是否有任何其他錯誤彈出