Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Nextcloud
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
Nextcloud
Commits
aad535e3
Unverified
Commit
aad535e3
authored
5 years ago
by
Joas Schilling
Browse files
Options
Downloads
Patches
Plain Diff
Log an error in development cases when the application class was set up incorrectly
Signed-off-by:
Joas Schilling
<
coding@schilljs.com
>
parent
f7319e13
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/public/AppFramework/App.php
+25
-2
25 additions, 2 deletions
lib/public/AppFramework/App.php
with
25 additions
and
2 deletions
lib/public/AppFramework/App.php
+
25
−
2
View file @
aad535e3
...
@@ -34,6 +34,7 @@ declare(strict_types=1);
...
@@ -34,6 +34,7 @@ declare(strict_types=1);
namespace
OCP\AppFramework
;
namespace
OCP\AppFramework
;
use
OC\AppFramework\Routing\RouteConfig
;
use
OC\AppFramework\Routing\RouteConfig
;
use
OC\ServerContainer
;
use
OCP\Route\IRouter
;
use
OCP\Route\IRouter
;
...
@@ -51,8 +52,8 @@ class App {
...
@@ -51,8 +52,8 @@ class App {
private
$container
;
private
$container
;
/**
/**
* Turns an app id into a namespace by convetion. The id is split at the
* Turns an app id into a namespace by conve
n
tion. The id is split at the
* underscores, all parts are
c
amel
c
ased and reassembled. e.g.:
* underscores, all parts are
C
amel
C
ased and reassembled. e.g.:
* some_app_id -> OCA\SomeAppId
* some_app_id -> OCA\SomeAppId
* @param string $appId the app id
* @param string $appId the app id
* @param string $topNamespace the namespace which should be prepended to
* @param string $topNamespace the namespace which should be prepended to
...
@@ -71,6 +72,28 @@ class App {
...
@@ -71,6 +72,28 @@ class App {
* @since 6.0.0
* @since 6.0.0
*/
*/
public
function
__construct
(
string
$appName
,
array
$urlParams
=
[])
{
public
function
__construct
(
string
$appName
,
array
$urlParams
=
[])
{
if
(
\OC
::
$server
->
getConfig
()
->
getSystemValueBool
(
'debug'
))
{
$applicationClassName
=
get_class
(
$this
);
$e
=
new
\RuntimeException
(
'App class '
.
$applicationClassName
.
' is not setup via query() but directly'
);
$setUpViaQuery
=
false
;
foreach
(
$e
->
getTrace
()
as
$step
)
{
if
(
isset
(
$step
[
'class'
],
$step
[
'function'
],
$step
[
'args'
][
0
])
&&
$step
[
'class'
]
===
ServerContainer
::
class
&&
$step
[
'function'
]
===
'query'
&&
$step
[
'args'
][
0
]
===
$applicationClassName
)
{
$setUpViaQuery
=
true
;
break
;
}
}
if
(
!
$setUpViaQuery
)
{
\OC
::
$server
->
getLogger
()
->
logException
(
$e
,
[
'app'
=>
$appName
,
]);
}
}
try
{
try
{
$this
->
container
=
\OC
::
$server
->
getRegisteredAppContainer
(
$appName
);
$this
->
container
=
\OC
::
$server
->
getRegisteredAppContainer
(
$appName
);
}
catch
(
QueryException
$e
)
{
}
catch
(
QueryException
$e
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment