More elegant handling of recursion
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
This commit is contained in:
parent
df14684817
commit
246e9ce547
|
@ -559,13 +559,17 @@ class DIContainer extends SimpleContainer implements IAppContainer {
|
|||
});
|
||||
}
|
||||
|
||||
public function query($name, $checkServerContainer = true) {
|
||||
public function query($name) {
|
||||
$name = $this->sanitizeName($name);
|
||||
|
||||
try {
|
||||
return parent::query($name);
|
||||
} catch (QueryException $e) {
|
||||
if ($checkServerContainer === false) {
|
||||
throw $e;
|
||||
if (strpos($name, 'OCA\\') === 0 && substr_count($name, '\\') >= 2) {
|
||||
$segments = explode('\\', $name);
|
||||
if (strtolower($segments[1]) === strtolower($this['AppName'])) {
|
||||
throw new QueryException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ class ServerContainer extends SimpleContainer {
|
|||
$segments = explode('\\', $name);
|
||||
$appContainer = $this->getAppContainer(strtolower($segments[1]));
|
||||
try {
|
||||
return $appContainer->query($name, false);
|
||||
return $appContainer->query($name);
|
||||
} catch (QueryException $e) {
|
||||
// Didn't find the service in the respective app container,
|
||||
// ignore it and fall back to the core container.
|
||||
|
|
Loading…
Reference in New Issue