Quickly Disable Any Magento Module For Troubleshooting

Quickly Disable any Magento Module for Troubleshooting
At Nexcess, we commonly run across problematic extension. Whether the issue is version incompatibilities, database problems, permissions problems, or anything else, the ability to quickly disable an extension or two for troubleshooting is extremely useful.

First, a bit about Magento’s file and folder structure. While the guide I just linked to shows some of the common things, it doesn’t mention where the module configs live: app/etc/modules.

Let’s see what version of Magento we’re looking at here:

$ grep -A6 Version app/Mage.php 
    public static function getVersion()
    {
        $i = self::getVersionInfo();
        return trim("{$i['major']}.{$i['minor']}.{$i['revision']}" . ($i['patch'] != '' ? ".{$i['patch']}" : "") . "-{$i['stability']}{$i['number']}", '.-');
    }

    /**
     * Gets the detailed Magento version information
     * @link http://www.magentocommerce.com/blog/new-community-edition-release-process/
--
    public static function getVersionInfo()
    {
        return array(
            'major'     => '1',
            'minor'     => '5',
            'revision'  => '0',
            'patch'     => '1',

The grep command:

grep -A6 Version app/Mage.php

is a great way to quickly determine the Magento version. You can see that the PHP function getVersionInfo() returns an array with the Magento version info. In this case, we can see that we’re looking at a Magento Community Edition 1.5.0.1 installation.

If we go into app/etc/modules, we can see all of the XML files for each of the installed modules:

$ ls -lah app/etc/modules/
total 76K
drwx--x--x 2 sipfourb sipfourb 4.0K Apr  1 17:22 ./
drwx--x--x 3 sipfourb sipfourb 4.0K Apr  1 17:22 ../
-rw-r--r-- 1 sipfourb sipfourb 1.2K Apr  1 17:22 Find_Feed.xml
-rw-r--r-- 1 sipfourb sipfourb  12K Apr  1 17:22 Mage_All.xml
-rw-r--r-- 1 sipfourb sipfourb 1.2K Apr  1 17:22 Mage_Api.xml
-rw-r--r-- 1 sipfourb sipfourb 1.3K Apr  1 17:22 Mage_Authorizenet.xml
-rw-r--r-- 1 sipfourb sipfourb 1.3K Apr  1 17:22 Mage_Bundle.xml
-rw-r--r-- 1 sipfourb sipfourb 1.3K Apr  1 17:22 Mage_Centinel.xml
-rw-r--r-- 1 sipfourb sipfourb 1.3K Apr  1 17:22 Mage_Compiler.xml
-rw-r--r-- 1 sipfourb sipfourb 1.2K Apr  1 17:22 Mage_Connect.xml
-rw-r--r-- 1 sipfourb sipfourb 1.3K Apr  1 17:22 Mage_Downloadable.xml
-rw-r--r-- 1 sipfourb sipfourb 1.2K Apr  1 17:22 Mage_ImportExport.xml
-rw-r--r-- 1 sipfourb sipfourb 1.3K Apr  1 17:22 Mage_PageCache.xml
-rw-r--r-- 1 sipfourb sipfourb 1.3K Apr  1 17:22 Mage_Weee.xml
-rw-r--r-- 1 sipfourb sipfourb 1.3K Apr  1 17:22 Mage_Widget.xml
-rw-r--r-- 1 sipfourb sipfourb 1.6K Apr  1 17:22 Mage_XmlConnect.xml
-rw-r--r-- 1 sipfourb sipfourb  959 Apr  1 17:22 Phoenix_Moneybookers.xml

Let’s open one up. I went with ‘Mage_ImportExport.xml’. Here are the contents:

<config>
    <modules>
	<Mage_ImportExport>
            <active>true</active>
            <codePool>core</codePool>
        </Mage_ImportExport>
    </modules>
</config>

Most of the configuration options look pretty self-explanatory. There are really only two options with values here; ‘active’ is set to ‘true’ and ‘codePool’ is set to ‘core’. That means that this particular extension is indeed active, and it is part of the core Magento extensions. We can gather from the codePool attribute that the module code will be in app/code/core/Mage/ImportExport/.

If we want to quickly disable this module, we’d just open up the XML configuration for it inside of app/etc/modules and change

<active>true</active>

to

<active>false</active>

If this eliminates or affects the issue that we’re trying to solve, then we have made progress and now know where to look for the specific cause of the issue.

This entry was posted in Nexcess. Bookmark the permalink.