summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJohn Molakvoæ <skjnldsv@users.noreply.github.com>2019-11-04 18:18:32 +0100
committerGitHub <noreply@github.com>2019-11-04 18:18:32 +0100
commit13960b69da2593dcfb0cbaef222ee8b9a33142c0 (patch)
treeca43ed0f4daa75e6b03b137b3ad650c8b721efa7 /lib
parent64bfd4bbeb10e07bd2133a97c50175a156d43d61 (diff)
parent964dc0a95520efbf876e0113bfafc294f4f4b322 (diff)
downloadnextcloud-server-13960b69da2593dcfb0cbaef222ee8b9a33142c0.tar.gz
nextcloud-server-13960b69da2593dcfb0cbaef222ee8b9a33142c0.zip
Merge pull request #17509 from nextcloud/fix/application-singleton
Fix Application instances created multiple times
Diffstat (limited to 'lib')
-rw-r--r--lib/base.php2
-rw-r--r--lib/private/Route/Router.php2
-rw-r--r--lib/private/ServerContainer.php3
3 files changed, 4 insertions, 3 deletions
diff --git a/lib/base.php b/lib/base.php
index 7674c16c26b..510a960e435 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -727,7 +727,7 @@ class OC {
// Make sure that the application class is not loaded before the database is setup
if ($systemConfig->getValue("installed", false)) {
OC_App::loadApp('settings');
- $settings = new \OCA\Settings\AppInfo\Application();
+ $settings = \OC::$server->query(\OCA\Settings\AppInfo\Application::class);
$settings->register();
}
diff --git a/lib/private/Route/Router.php b/lib/private/Route/Router.php
index 3d91a33cd8a..4c83f251012 100644
--- a/lib/private/Route/Router.php
+++ b/lib/private/Route/Router.php
@@ -371,7 +371,7 @@ class Router implements IRouter {
$applicationClassName = $appNameSpace . '\\AppInfo\\Application';
if (class_exists($applicationClassName)) {
- $application = new $applicationClassName();
+ $application = \OC::$server->query($applicationClassName);
} else {
$application = new App($appName);
}
diff --git a/lib/private/ServerContainer.php b/lib/private/ServerContainer.php
index b67b4d1e701..704d207223b 100644
--- a/lib/private/ServerContainer.php
+++ b/lib/private/ServerContainer.php
@@ -100,8 +100,9 @@ class ServerContainer extends SimpleContainer {
if (!isset($this->hasNoAppContainer[$namespace])) {
$applicationClassName = 'OCA\\' . $sensitiveNamespace . '\\AppInfo\\Application';
if (class_exists($applicationClassName)) {
- new $applicationClassName();
+ $app = new $applicationClassName();
if (isset($this->appContainers[$namespace])) {
+ $this->appContainers[$namespace]->offsetSet($applicationClassName, $app);
return $this->appContainers[$namespace];
}
}