From a24bf32c5b1217ddad76defea692ad18eab5fae4 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Thu, 12 Nov 2015 18:30:18 +0100 Subject: [PATCH] Hook: allow hooks for old modules Web\Hooks refs #10613 --- library/Icinga/Application/Hook.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/library/Icinga/Application/Hook.php b/library/Icinga/Application/Hook.php index e3ef616a8..ed38a7fe8 100644 --- a/library/Icinga/Application/Hook.php +++ b/library/Icinga/Application/Hook.php @@ -155,6 +155,20 @@ class Hook } if (!$instance instanceof $base_class) { + + // This is a compatibility check. Should be removed one far day: + if ($module !== null) { + $compat_class = 'Icinga\\Module\\' + . ucfirst($module) + . '\\Web\\Hook\\' + . ucfirst($name) + . $suffix; + + if ($instance instanceof $compat_class) { + return; + } + } + throw new ProgrammingError( '%s is not an instance of %s', get_class($instance),