From 1c2675568667aeccf9855e70970bb1b09ccab13e Mon Sep 17 00:00:00 2001 From: Robin McCorkell Date: Tue, 18 Aug 2015 09:18:36 +0100 Subject: [PATCH] Only load app routes if the app has already been loaded --- lib/private/app.php | 10 ++++++++++ lib/private/route/router.php | 6 ++++++ 2 files changed, 16 insertions(+) diff --git a/lib/private/app.php b/lib/private/app.php index 6c6f79dfa9..9de1c66ee5 100644 --- a/lib/private/app.php +++ b/lib/private/app.php @@ -73,6 +73,16 @@ class OC_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 * diff --git a/lib/private/route/router.php b/lib/private/route/router.php index 4899236609..33669452f2 100644 --- a/lib/private/route/router.php +++ b/lib/private/route/router.php @@ -150,6 +150,12 @@ class Router implements IRouter { \OC::$server->getEventLogger()->start('loadroutes' . $requestedApp, 'Loading Routes'); foreach ($routingFiles as $app => $file) { 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->useCollection($app); $this->requireRouteFile($file, $app);