// small fix
This commit is contained in:
+6
-2
@@ -390,6 +390,10 @@ class HookCore extends ObjectModel
|
||||
*/
|
||||
public static function exec($hook_name, $hook_args = array(), $id_module = null, $array_return = false, $check_exceptions = true, $use_push = false)
|
||||
{
|
||||
static $disable_non_native_modules = null;
|
||||
if ($disable_non_native_modules === null)
|
||||
$disable_non_native_modules = (bool)Configuration::get('PS_DISABLE_NON_NATIVE_MODULE');
|
||||
|
||||
// Check arguments validity
|
||||
if (($id_module && !is_numeric($id_module)) || !Validate::isHookName($hook_name))
|
||||
throw new PrestaShopException('Invalid id_module or hook_name');
|
||||
@@ -419,7 +423,7 @@ class HookCore extends ObjectModel
|
||||
$altern = 0;
|
||||
$output = '';
|
||||
|
||||
if (!isset(Hook::$native_module))
|
||||
if ($disable_non_native_modules && !isset(Hook::$native_module))
|
||||
Hook::$native_module = Module::getNativeModuleList();
|
||||
|
||||
foreach ($module_list as $array)
|
||||
@@ -428,7 +432,7 @@ class HookCore extends ObjectModel
|
||||
if ($id_module && $id_module != $array['id_module'])
|
||||
continue;
|
||||
|
||||
if ((bool)Configuration::get('PS_DISABLE_NON_NATIVE_MODULE') && !in_array($array['module'], self::$native_module))
|
||||
if ((bool)$disable_non_native_modules && Hook::$native_module && count(Hook::$native_module) && !in_array($array['module'], self::$native_module))
|
||||
continue;
|
||||
|
||||
if (!($moduleInstance = Module::getInstanceByName($array['module'])))
|
||||
|
||||
@@ -1309,6 +1309,9 @@ abstract class ModuleCore
|
||||
public static function getNativeModuleList()
|
||||
{
|
||||
$module_list_xml = _PS_ROOT_DIR_.self::CACHE_FILE_MODULES_LIST;
|
||||
if (!file_exists($module_list_xml))
|
||||
return false;
|
||||
|
||||
$native_modules = simplexml_load_file($module_list_xml);
|
||||
$native_modules = $native_modules->modules;
|
||||
$modules = array();
|
||||
|
||||
Reference in New Issue
Block a user