From d38cc11f7ea2df8e6263ded58819018a1f78299b Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Sat, 8 Jul 2017 18:04:26 +0200 Subject: [PATCH] do NOT catch exceptions in hooks maybe we need some parameter to hooks-calls, if all hooks should run, before exception get's re-thrown, as with this commit first exeception in a hook, will stop other hooks from running. --- api/src/Hooks.php | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/api/src/Hooks.php b/api/src/Hooks.php index 33c5715886..83085c6ed2 100644 --- a/api/src/Hooks.php +++ b/api/src/Hooks.php @@ -114,7 +114,7 @@ class Hooks return false; } - $ret = $redirects = array(); + $ret = array(); foreach((array)self::$locations[$location][$appname] as $hook) { try { @@ -143,22 +143,17 @@ class Hooks $ret[] = ExecMethod2($hook, $args); } } - catch (Exception\Redirect $e) + catch (Api\Exception\AssertionFailed $e) { - $redirects[] = $e; + if (preg_match('/ file .+ not found!$/', $e->getMessage())) + { + // ignore not found hook + } + else + { + throw $e; + } } - catch (\Exception $e) { - _egw_log_exception($e); - } - } - - if ($redirects) - { - if (count($redirects) > 1) - { - error_log("Multiple redirects for location '$location', only first one gets executed!"); - } - throw $redirects[0]; } // hooks only existing in filesystem used by setup