How to disable all local modules easily in Magento

All of our custom developed modules are stored in the app/code/local folder. If in case an error has not been logged in error log files and to troubleshoot we want to check whether one of our custom modules is causing problems or not, so in that case we should first disable all local modules and see if the site is working or not.

To disable all the local modules:

1. Open the app/etc/local.xml file and locate “disable_local_modules” xml tag

<config>
<global>
<install>
<date><![CDATA[Tue, 29 May 2012 10:49:18 +0000]]></date>
</install>
<crypt>
<key><![CDATA[8584c79dab6225c07216a6bcd7f297d9]]></key>
</crypt>
<disable_local_modules>false</disable_local_modules>
.
.
.
</config>

2. Change the <disable_local_modules> xml tag to true

<disable_local_modules>true</disable_local_modules>

3. Clear the Magento Cache

Now test the website. If the error goes away, it means one of your custom modules is causing problem. You now need to disable individual modules and check to find the culprit module.

The check for local modules enable/disable flag is implemented in protected function _canUseLocalModules() in the file located at \app\code\core\Mage\Core\Model\Config.php


protected function _canUseLocalModules()
{
if ($this->_canUseLocalModules !== null) {
return $this->_canUseLocalModules;
}

$disableLocalModules = (string)$this->getNode('global/disable_local_modules');
if (!empty($disableLocalModules)) {
$disableLocalModules = (('true' === $disableLocalModules) || ('1' === $disableLocalModules));
} else {
$disableLocalModules = false;
}

if ($disableLocalModules && !defined('COMPILER_INCLUDE_PATH')) {
set_include_path(
// excluded '/app/code/local'
BP . DS . 'app' . DS . 'code' . DS . 'community' . PS .
BP . DS . 'app' . DS . 'code' . DS . 'core' . PS .
BP . DS . 'lib' . PS .
Mage::registry('original_include_path')
);
}
$this->_canUseLocalModules = !$disableLocalModules;
return $this->_canUseLocalModules;
}

Leave a Comment

Back to top