Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
die_coolen_jungs
our_own_cloud_project
Commits
1f197134
Commit
1f197134
authored
Dec 18, 2015
by
Joas Schilling
Browse files
Look up services in the app container before trying the core container
parent
412e4ed3
Changes
1
Hide whitespace changes
Inline
Side-by-side
lib/private/servercontainer.php
View file @
1f197134
...
...
@@ -62,4 +62,28 @@ class ServerContainer extends SimpleContainer {
return
new
DIContainer
(
$appName
);
}
/**
* @param string $name name of the service to query for
* @return mixed registered service for the given $name
* @throws QueryException if the query could not be resolved
*/
public
function
query
(
$name
)
{
$name
=
$this
->
sanitizeName
(
$name
);
// In case the service starts with OCA\ we try to find the service in
// the apps container first.
if
(
strpos
(
$name
,
'OCA\\'
)
===
0
&&
substr_count
(
$name
,
'\\'
)
>=
2
)
{
$segments
=
explode
(
'\\'
,
$name
);
$appContainer
=
$this
->
getAppContainer
(
strtolower
(
$segments
[
0
]));
try
{
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.
}
}
return
parent
::
query
(
$name
);
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment