Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Determine if Magento module is enabled

What is the best way to determine if a particular module is enabled/active in Magento? I've tried using class_exists to check if my code has been loaded and parsed by PHP but lately I've noticed its pretty unreliable (returns true even when I delete the module's .xml configuration).

Is there a core function I can call?

like image 981
Colin O'Dell Avatar asked Aug 23 '10 21:08

Colin O'Dell


People also ask

What is the CLI command to check the status of your module?

Here is what you need to do: Log In via SSH/CLI to your domain and navigate to the root of your store. Run command bin/magento module:status . It will give you a list of enabled modules, where you can pick up an internal name of module you wish to remove.

Which command is used to enable magento 2 module?

Step 3: Enable/ Disable Magento 2 module --all mentions you can simultaneously enable or disable all modules. -f or --force means you obligate to enable or disable the modules regardless the dependencies. -c or --clear-static-content means clear any published static view files.


2 Answers

If you would like to use a build in function just use

Mage::helper('core')->isModuleEnabled(<module name>); 

It is implemented in

Mage_Core_Helper_Abstract 
like image 62
datenbrille Avatar answered Oct 05 '22 20:10

datenbrille


Here's another option that is a more elegant way of finding out the status:

Mage::getConfig()->getModuleConfig('modulename')->is('active', 'true') 
like image 23
Jonathan Day Avatar answered Oct 05 '22 21:10

Jonathan Day