summaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2017-03-22 10:33:30 +0100
committerJoas Schilling <coding@schilljs.com>2017-03-22 10:44:13 +0100
commit5695a4ec9287775912b9df1b0038964543e257d1 (patch)
tree5d3e24a9fb1055b734cf30ee06600ac702137609 /lib/private
parent9208f6379cf74731e2cd2acb77cac0403bacd00e (diff)
downloadnextcloud-server-5695a4ec9287775912b9df1b0038964543e257d1.tar.gz
nextcloud-server-5695a4ec9287775912b9df1b0038964543e257d1.zip
Don't do a recursive search
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/AppFramework/DependencyInjection/DIContainer.php22
-rw-r--r--lib/private/ServerContainer.php2
2 files changed, 22 insertions, 2 deletions
diff --git a/lib/private/AppFramework/DependencyInjection/DIContainer.php b/lib/private/AppFramework/DependencyInjection/DIContainer.php
index 9078baf1d2f..4fb13b09ae0 100644
--- a/lib/private/AppFramework/DependencyInjection/DIContainer.php
+++ b/lib/private/AppFramework/DependencyInjection/DIContainer.php
@@ -49,6 +49,7 @@ use OC\ServerContainer;
use OCP\AppFramework\Http\IOutput;
use OCP\AppFramework\IApi;
use OCP\AppFramework\IAppContainer;
+use OCP\AppFramework\QueryException;
use OCP\Files\Folder;
use OCP\Files\IAppData;
use OCP\IL10N;
@@ -373,7 +374,25 @@ class DIContainer extends SimpleContainer implements IAppContainer {
});
}
+ /**
+ * @param string $name
+ * @return mixed
+ * @throws QueryException if the query could not be resolved
+ */
public function query($name) {
+ try {
+ return $this->queryNoFallback($name);
+ } catch (QueryException $e) {
+ return $this->getServer()->query($name);
+ }
+ }
+
+ /**
+ * @param string $name
+ * @return mixed
+ * @throws QueryException if the query could not be resolved
+ */
+ public function queryNoFallback($name) {
$name = $this->sanitizeName($name);
if ($this->offsetExists($name)) {
@@ -388,6 +407,7 @@ class DIContainer extends SimpleContainer implements IAppContainer {
}
}
- return $this->getServer()->query($name);
+ throw new QueryException('Could not resolve ' . $name . '!' .
+ ' Class can not be instantiated');
}
}
diff --git a/lib/private/ServerContainer.php b/lib/private/ServerContainer.php
index df0293addf7..fe868867b5a 100644
--- a/lib/private/ServerContainer.php
+++ b/lib/private/ServerContainer.php
@@ -79,7 +79,7 @@ class ServerContainer extends SimpleContainer {
$segments = explode('\\', $name);
$appContainer = $this->getAppContainer(strtolower($segments[1]));
try {
- return $appContainer->query($name);
+ return $appContainer->queryNoFallback($name);
} catch (QueryException $e) {
// Didn't find the service in the respective app container,
// ignore it and fall back to the core container.