From dadff366607967d209a037d055bf848fabb61b74 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Tue, 8 Jul 2025 13:00:53 +0200 Subject: [PATCH] Module: Expect user and group backends upon registration Providing a user or user group backend in configuration.php now has no effect anymore. They are expected to be announced in run.php, just like hooks. A warning appears in the log for cases where a configuration.php still attempts it. Should help with troubleshooting since it will appear after an error that a specific backend has not been found. refs #5265 --- library/Icinga/Application/Modules/Module.php | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/library/Icinga/Application/Modules/Module.php b/library/Icinga/Application/Modules/Module.php index 6a5afb881..a703287f9 100644 --- a/library/Icinga/Application/Modules/Module.php +++ b/library/Icinga/Application/Modules/Module.php @@ -1068,7 +1068,6 @@ class Module */ public function getUserBackends() { - $this->launchConfigScript(); return $this->userBackends; } @@ -1079,7 +1078,6 @@ class Module */ public function getUserGroupBackends() { - $this->launchConfigScript(); return $this->userGroupBackends; } @@ -1180,6 +1178,14 @@ class Module */ protected function provideUserBackend($identifier, $className) { + if ($this->registered) { + Logger::warning( + 'Module "%s" already registered. Providing user backend "%s" at this stage has no effect.', + $this->getName(), + $identifier + ); + } + $this->userBackends[strtolower($identifier)] = $className; return $this; } @@ -1194,6 +1200,14 @@ class Module */ protected function provideUserGroupBackend($identifier, $className) { + if ($this->registered) { + Logger::warning( + 'Module "%s" already registered. Providing user group backend "%s" at this stage has no effect.', + $this->getName(), + $identifier + ); + } + $this->userGroupBackends[strtolower($identifier)] = $className; return $this; }