Skip to content

Commit 10e2edc

Browse files
authored
Merge pull request #16638 from nextcloud/fix/noid/ldap-ext-storage-handler-loading-cli
delay sending event from app init to when they are needed
2 parents b42b26e + 792903e commit 10e2edc

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

apps/files_external/lib/AppInfo/Application.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,6 @@ public function __construct(array $urlParams = []) {
9393
// force-load auth mechanisms since some will register hooks
9494
// TODO: obsolete these and use the TokenProvider to get the user's password from the session
9595
$this->getAuthMechanisms();
96-
97-
// don't remove this, as app loading order might be a side effect and
98-
// querying the service from the server not reliable
99-
\OC::$server->getEventDispatcher()->dispatch(
100-
'OCA\\Files_External::loadAdditionalBackends'
101-
);
10296
}
10397

10498
/**

apps/files_external/lib/Service/BackendService.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,18 @@ public function registerBackendProvider(IBackendProvider $provider) {
106106
$this->backendProviders[] = $provider;
107107
}
108108

109+
private function callForRegistrations() {
110+
static $eventSent = false;
111+
if(!$eventSent) {
112+
\OC::$server->getEventDispatcher()->dispatch(
113+
'OCA\\Files_External::loadAdditionalBackends'
114+
);
115+
$eventSent = true;
116+
}
117+
}
118+
109119
private function loadBackendProviders() {
120+
$this->callForRegistrations();
110121
foreach ($this->backendProviders as $provider) {
111122
$this->registerBackends($provider->getBackends());
112123
}
@@ -124,6 +135,7 @@ public function registerAuthMechanismProvider(IAuthMechanismProvider $provider)
124135
}
125136

126137
private function loadAuthMechanismProviders() {
138+
$this->callForRegistrations();
127139
foreach ($this->authMechanismProviders as $provider) {
128140
$this->registerAuthMechanisms($provider->getAuthMechanisms());
129141
}
@@ -321,6 +333,7 @@ public function registerConfigHandler(string $placeholder, callable $configHandl
321333
}
322334

323335
protected function loadConfigHandlers():void {
336+
$this->callForRegistrations();
324337
$newLoaded = false;
325338
foreach ($this->configHandlerLoaders as $placeholder => $loader) {
326339
$handler = $loader();

0 commit comments

Comments
 (0)