Merge pull request #16695 from nextcloud/backport/16638/stable16
[stable16] delay sending event from app init to when they are needed
This commit is contained in:
commit
d88324e5e8
|
@ -93,12 +93,6 @@ class Application extends App implements IBackendProvider, IAuthMechanismProvide
|
||||||
// force-load auth mechanisms since some will register hooks
|
// force-load auth mechanisms since some will register hooks
|
||||||
// TODO: obsolete these and use the TokenProvider to get the user's password from the session
|
// TODO: obsolete these and use the TokenProvider to get the user's password from the session
|
||||||
$this->getAuthMechanisms();
|
$this->getAuthMechanisms();
|
||||||
|
|
||||||
// don't remove this, as app loading order might be a side effect and
|
|
||||||
// querying the service from the server not reliable
|
|
||||||
\OC::$server->getEventDispatcher()->dispatch(
|
|
||||||
'OCA\\Files_External::loadAdditionalBackends'
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -106,7 +106,18 @@ class BackendService {
|
||||||
$this->backendProviders[] = $provider;
|
$this->backendProviders[] = $provider;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function callForRegistrations() {
|
||||||
|
static $eventSent = false;
|
||||||
|
if(!$eventSent) {
|
||||||
|
\OC::$server->getEventDispatcher()->dispatch(
|
||||||
|
'OCA\\Files_External::loadAdditionalBackends'
|
||||||
|
);
|
||||||
|
$eventSent = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private function loadBackendProviders() {
|
private function loadBackendProviders() {
|
||||||
|
$this->callForRegistrations();
|
||||||
foreach ($this->backendProviders as $provider) {
|
foreach ($this->backendProviders as $provider) {
|
||||||
$this->registerBackends($provider->getBackends());
|
$this->registerBackends($provider->getBackends());
|
||||||
}
|
}
|
||||||
|
@ -124,6 +135,7 @@ class BackendService {
|
||||||
}
|
}
|
||||||
|
|
||||||
private function loadAuthMechanismProviders() {
|
private function loadAuthMechanismProviders() {
|
||||||
|
$this->callForRegistrations();
|
||||||
foreach ($this->authMechanismProviders as $provider) {
|
foreach ($this->authMechanismProviders as $provider) {
|
||||||
$this->registerAuthMechanisms($provider->getAuthMechanisms());
|
$this->registerAuthMechanisms($provider->getAuthMechanisms());
|
||||||
}
|
}
|
||||||
|
@ -321,6 +333,7 @@ class BackendService {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function loadConfigHandlers():void {
|
protected function loadConfigHandlers():void {
|
||||||
|
$this->callForRegistrations();
|
||||||
$newLoaded = false;
|
$newLoaded = false;
|
||||||
foreach ($this->configHandlerLoaders as $placeholder => $loader) {
|
foreach ($this->configHandlerLoaders as $placeholder => $loader) {
|
||||||
$handler = $loader();
|
$handler = $loader();
|
||||||
|
|
Loading…
Reference in New Issue