Only load app routes if the app has already been loaded

This commit is contained in:
Robin McCorkell 2015-08-18 09:18:36 +01:00
parent 03965053c3
commit 1c26755686
2 changed files with 16 additions and 0 deletions

View File

@ -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
*

View File

@ -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);