Magento: Check if a module is installed, enabled or active

Here is a quick code to check if a Magento module is installed, enabled or active.

The functions isModuleEnabled and isModuleOutputEnabled are present in Mage_Core_Helper_Abstract class.


$moduleName = 'Mage_Core'; // edit to your required module name
if (Mage::helper('core')->isModuleEnabled($moduleName)) {
	echo "Module is enabled.";
} else {
	echo "Module is disabled.";
}

You can also check if the output of the module is enabled or not. The following function will also check if the module is enabled or not.


$moduleName = 'Mage_Core'; // edit to your required module name
if (Mage::helper('core')->isModuleOutputEnabled($moduleName)) {
	echo "Module is enabled.";
} else {
	echo "Module is disabled.";
}

isModuleEnabled function might not be present in older versions of Magento. If it is so, then you can use the following code to check whether a module is installed or active.


$moduleName = 'Mage_Core'; // edit to your required module name
$isActive = Mage::getConfig()->getNode('modules/' . $moduleName . '/active');
if ($isActive && in_array((string)$isActive, array('true', '1'))) {
	echo "Module is enabled.";
} else {
	echo "Module is disabled.";
}

Hope it helps. Thanks.