aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/private/ServerContainer.php13
-rw-r--r--lib/public/AppFramework/App.php7
2 files changed, 19 insertions, 1 deletions
diff --git a/lib/private/ServerContainer.php b/lib/private/ServerContainer.php
index e1447d2f06b..4c8107fe1be 100644
--- a/lib/private/ServerContainer.php
+++ b/lib/private/ServerContainer.php
@@ -72,6 +72,19 @@ class ServerContainer extends SimpleContainer {
}
/**
+ * @param string $appName
+ * @return DIContainer
+ * @throws QueryException
+ */
+ public function getRegisteredAppContainer(string $appName) {
+ if (isset($this->appContainers[strtolower(App::buildAppNamespace($appName, ''))])) {
+ return $this->appContainers[strtolower(App::buildAppNamespace($appName, ''))];
+ }
+
+ throw new QueryException();
+ }
+
+ /**
* @param string $namespace
* @param string $sensitiveNamespace
* @return DIContainer
diff --git a/lib/public/AppFramework/App.php b/lib/public/AppFramework/App.php
index b6ed2da5076..06524e4bf02 100644
--- a/lib/public/AppFramework/App.php
+++ b/lib/public/AppFramework/App.php
@@ -66,11 +66,16 @@ class App {
/**
+ * @param string $appName
* @param array $urlParams an array with variables extracted from the routes
* @since 6.0.0
*/
public function __construct(string $appName, array $urlParams = []) {
- $this->container = new \OC\AppFramework\DependencyInjection\DIContainer($appName, $urlParams);
+ try {
+ $this->container = \OC::$server->getRegisteredAppContainer($appName);
+ } catch (QueryException $e) {
+ $this->container = new \OC\AppFramework\DependencyInjection\DIContainer($appName, $urlParams);
+ }
}
/**