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
This commit is contained in:
Johannes Meyer 2025-07-08 13:00:53 +02:00
parent fff524624e
commit dadff36660

View File

@ -1068,7 +1068,6 @@ class Module
*/ */
public function getUserBackends() public function getUserBackends()
{ {
$this->launchConfigScript();
return $this->userBackends; return $this->userBackends;
} }
@ -1079,7 +1078,6 @@ class Module
*/ */
public function getUserGroupBackends() public function getUserGroupBackends()
{ {
$this->launchConfigScript();
return $this->userGroupBackends; return $this->userGroupBackends;
} }
@ -1180,6 +1178,14 @@ class Module
*/ */
protected function provideUserBackend($identifier, $className) 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; $this->userBackends[strtolower($identifier)] = $className;
return $this; return $this;
} }
@ -1194,6 +1200,14 @@ class Module
*/ */
protected function provideUserGroupBackend($identifier, $className) 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; $this->userGroupBackends[strtolower($identifier)] = $className;
return $this; return $this;
} }