[+] PROJECT : Add method Module::isEnabled

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@15866 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
fSerny
2012-06-06 08:58:13 +00:00
parent 1c03997f30
commit 49fd8708a1

View File

@@ -1459,6 +1459,19 @@ abstract class ModuleCore
return Cache::retrieve('Module::isInstalled'.$module_name);
}
public static function isEnabled($module_name)
{
if (!Cache::isStored('Module::isEnabled'.$module_name))
{
$active = false;
$id_module = Db::getInstance()->getValue('SELECT `id_module` FROM `'._DB_PREFIX_.'module` WHERE `name` = \''.pSQL($module_name).'\'');
if (Db::getInstance()->getValue('SELECT `id_module` FROM `'._DB_PREFIX_.'module_shop` WHERE `id_module` = '.(int)$id_module.' AND `id_shop` = '.(int)Context::getContext()->shop->id))
$active = true;
Cache::store('Module::isEnabled'.$module_name, (bool)$active);
}
return Cache::retrieve('Module::isEnabled'.$module_name);
}
public function isRegisteredInHook($hook)
{
if (!$this->id)