Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache isModuleOutputEnabled or isModuleEnabled status #4323

Open
wants to merge 22 commits into
base: main
Choose a base branch
from
Open
Changes from 2 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions app/code/core/Mage/Core/Helper/Abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ abstract class Mage_Core_Helper_Abstract
*/
protected $_layout;

protected array $modulesDisabled = [];
kiatng marked this conversation as resolved.
Show resolved Hide resolved

protected array $modulesDisabledOutput = [];

/**
* Retrieve request object
*
Expand Down Expand Up @@ -135,7 +139,12 @@ public function isModuleOutputEnabled($moduleName = null)
return false;
}

return !Mage::getStoreConfigFlag('advanced/modules_disable_output/' . $moduleName);
if (array_key_exists($moduleName, $this->modulesDisabledOutput)) {
return $this->modulesDisabledOutput[$moduleName];
}

$config = !Mage::getStoreConfigFlag('advanced/modules_disable_output/' . $moduleName);
return $this->modulesDisabledOutput[$moduleName] = $config;
}

/**
Expand All @@ -150,15 +159,19 @@ public function isModuleEnabled($moduleName = null)
$moduleName = $this->_getModuleName();
}

if (array_key_exists($moduleName, $this->modulesDisabled)) {
return $this->modulesDisabled[$moduleName];
}

if (!Mage::getConfig()->getNode('modules/' . $moduleName)) {
return false;
return $this->modulesDisabled[$moduleName] = false;
}

$isActive = Mage::getConfig()->getNode('modules/' . $moduleName . '/active');
if (!$isActive || !in_array((string)$isActive, ['true', '1'])) {
return false;
return $this->modulesDisabled[$moduleName] = false;
}
return true;
return $this->modulesDisabled[$moduleName] = true;
}

/**
Expand Down
Loading