From bb852592e65dda61f53a0c9eb53203453cdfbcee Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 5 Oct 2014 04:49:46 +0200 Subject: [PATCH] Fix: Restore broken feature. One hook = One call of function per module. --- htdocs/core/class/hookmanager.class.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php index babddd9a2fe..4f7044e3d1f 100644 --- a/htdocs/core/class/hookmanager.class.php +++ b/htdocs/core/class/hookmanager.class.php @@ -157,8 +157,6 @@ class HookManager { if (! empty($modules)) { - $modulealreadyexecuted[$context]=array(); // Filter by context - foreach($modules as $module => $actionclassinstance) { //print "Before hook ".get_class($actionclassinstance)." method=".$method." hooktype=".$hooktype." results=".count($actionclassinstance->results)." resprints=".count($actionclassinstance->resprints)." resaction=".$resaction." result=".$result."
\n"; @@ -167,8 +165,8 @@ class HookManager // jump to next class if method does not exists if (! method_exists($actionclassinstance,$method)) continue; // test to avoid to run twice a hook, when a module implements several active contexts - if (in_array($module,$modulealreadyexecuted[$context])) continue; - $modulealreadyexecuted[$context][$module]=$module; // Use the $currentcontext in method for avoid to run twice + if (in_array($module,$modulealreadyexecuted)) continue; + $modulealreadyexecuted[$module]=$module; // Use the $currentcontext in method for avoid to run twice // Add current context for avoid method execution in bad context, you can add this test in your method : eg if($currentcontext != 'formfile') return; $parameters['currentcontext'] = $context; // Hooks that must return int (hooks with type 'addreplace')