Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2019-08-08 20:17:27 +0300
committerGitHub <noreply@github.com>2019-08-08 20:17:27 +0300
commitd88324e5e8eecb473e0f2c647c742a36bb236c7d (patch)
tree0ea4ba3540abaf48d6a50e68465d74af54dd1833
parent6bfcf97c7fadea7e1d7dd8c87d45c3369f6babe2 (diff)
parent18aa047dd44d8ffb66609e1d80088e569f6c2719 (diff)
Merge pull request #16695 from nextcloud/backport/16638/stable16
[stable16] delay sending event from app init to when they are needed
-rw-r--r--apps/files_external/lib/AppInfo/Application.php6
-rw-r--r--apps/files_external/lib/Service/BackendService.php13
2 files changed, 13 insertions, 6 deletions
diff --git a/apps/files_external/lib/AppInfo/Application.php b/apps/files_external/lib/AppInfo/Application.php
index 01de6f1e40b..7a9325414d8 100644
--- a/apps/files_external/lib/AppInfo/Application.php
+++ b/apps/files_external/lib/AppInfo/Application.php
@@ -93,12 +93,6 @@ class Application extends App implements IBackendProvider, IAuthMechanismProvide
// 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
$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'
- );
}
/**
diff --git a/apps/files_external/lib/Service/BackendService.php b/apps/files_external/lib/Service/BackendService.php
index bd4d2bffa7b..59af54f79e4 100644
--- a/apps/files_external/lib/Service/BackendService.php
+++ b/apps/files_external/lib/Service/BackendService.php
@@ -106,7 +106,18 @@ class BackendService {
$this->backendProviders[] = $provider;
}
+ private function callForRegistrations() {
+ static $eventSent = false;
+ if(!$eventSent) {
+ \OC::$server->getEventDispatcher()->dispatch(
+ 'OCA\\Files_External::loadAdditionalBackends'
+ );
+ $eventSent = true;
+ }
+ }
+
private function loadBackendProviders() {
+ $this->callForRegistrations();
foreach ($this->backendProviders as $provider) {
$this->registerBackends($provider->getBackends());
}
@@ -124,6 +135,7 @@ class BackendService {
}
private function loadAuthMechanismProviders() {
+ $this->callForRegistrations();
foreach ($this->authMechanismProviders as $provider) {
$this->registerAuthMechanisms($provider->getAuthMechanisms());
}
@@ -321,6 +333,7 @@ class BackendService {
}
protected function loadConfigHandlers():void {
+ $this->callForRegistrations();
$newLoaded = false;
foreach ($this->configHandlerLoaders as $placeholder => $loader) {
$handler = $loader();