Skip to content

Instantly share code, notes, and snippets.

@KaySchneider
Created April 4, 2017 09:49
Show Gist options
  • Save KaySchneider/a4d78438b70b0ba4524f852ac57a8b0b to your computer and use it in GitHub Desktop.
Save KaySchneider/a4d78438b70b0ba4524f852ac57a8b0b to your computer and use it in GitHub Desktop.
How to deactiavate a magento module programmatically
<?php
class MySuperController {
protected function _disableModule($moduleName) {
// Disable the module itself
$nodePath = "modules/$moduleName/active";
if (Mage::helper('core/data')->isModuleEnabled($moduleName)) {
Mage::getConfig()->setNode($nodePath, 'false', true);
}
// Disable its output as well (which was already loaded)
$outputPath = "advanced/modules_disable_output/$moduleName";
if (!Mage::getStoreConfig($outputPath)) {
Mage::app()->getStore()->setConfig($outputPath, true);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment