mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-08 23:19:04 +01:00
allow hooks to send redirects via Exception\Redirect, thought only first redirect will be executed, if there are multiple hooks
This commit is contained in:
parent
254ca19c2d
commit
a468c57284
@ -114,7 +114,7 @@ class Hooks
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$ret = array();
|
$ret = $redirects = array();
|
||||||
foreach((array)self::$locations[$location][$appname] as $hook)
|
foreach((array)self::$locations[$location][$appname] as $hook)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
@ -143,11 +143,24 @@ class Hooks
|
|||||||
$ret[] = ExecMethod2($hook, $args);
|
$ret[] = ExecMethod2($hook, $args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (Exception\Redirect $e)
|
||||||
|
{
|
||||||
|
$redirects[] = $e;
|
||||||
|
}
|
||||||
catch (\Exception $e) {
|
catch (\Exception $e) {
|
||||||
_egw_log_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
|
// hooks only existing in filesystem used by setup
|
||||||
if (!$ret && $try_unregistered && file_exists(EGW_SERVER_ROOT.($hook='/'.$appname.'/inc/hook_'.$location.'.inc.php')))
|
if (!$ret && $try_unregistered && file_exists(EGW_SERVER_ROOT.($hook='/'.$appname.'/inc/hook_'.$location.'.inc.php')))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user