June 19, 2011

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:
[php]$ 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’,[/php]
The grep command:
[bash]grep -A6 Version app/Mage.php[/bash]
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:
[bash]$ 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[/bash]
Let’s open one up. I went with ‘Mage_ImportExport.xml’. Here are the contents:
[xml]


true
core


[/xml]
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
[xml]true[/xml]
to
[xml]false[/xml]
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.

Nexcess
Nexcess

Nexcess, the premium hosting provider for WordPress, WooCommerce, and Magento, is optimized for your hosting needs. Nexcess provides a managed hosting infrastructure, curated tools, and a team of experts that make it easy to build, manage, and grow your business online. Serving SMBs and the designers, developers, and agencies who create for them, Nexcess has provided fully managed, high-performance cloud solutions for more than 22 years.


We use cookies to understand how you interact with our site, to personalize and streamline your experience, and to tailor advertising. By continuing to use our site, you accept our use of cookies and accept our Privacy Policy.