Skip to content
Snippets Groups Projects
Commit 50ebea41 authored by Robin McCorkell's avatar Robin McCorkell
Browse files

Only load app routes if the app has already been loaded

parent 6c139674
Branches
No related tags found
No related merge requests found
...@@ -73,6 +73,16 @@ class OC_App { ...@@ -73,6 +73,16 @@ class OC_App {
return str_replace(array('\0', '/', '\\', '..'), '', $app); return str_replace(array('\0', '/', '\\', '..'), '', $app);
} }
/**
* Check if an app is loaded
*
* @param string $app
* @return bool
*/
public static function isAppLoaded($app) {
return in_array($app, self::$loadedApps, true);
}
/** /**
* loads all apps * loads all apps
* *
......
...@@ -150,6 +150,12 @@ class Router implements IRouter { ...@@ -150,6 +150,12 @@ class Router implements IRouter {
\OC::$server->getEventLogger()->start('loadroutes' . $requestedApp, 'Loading Routes'); \OC::$server->getEventLogger()->start('loadroutes' . $requestedApp, 'Loading Routes');
foreach ($routingFiles as $app => $file) { foreach ($routingFiles as $app => $file) {
if (!isset($this->loadedApps[$app])) { if (!isset($this->loadedApps[$app])) {
if (!\OC_App::isAppLoaded($app)) {
// app MUST be loaded before app routes
// try again next time loadRoutes() is called
$this->loaded = false;
continue;
}
$this->loadedApps[$app] = true; $this->loadedApps[$app] = true;
$this->useCollection($app); $this->useCollection($app);
$this->requireRouteFile($file, $app); $this->requireRouteFile($file, $app);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment