From 4680691ca6912cb5448cc1a09250464b28396474 Mon Sep 17 00:00:00 2001 From: Lukas Reschke Date: Tue, 15 Sep 2015 11:55:23 +0200 Subject: [PATCH] Define allowed app roots earlier The autoloader needs to be run before including the app.php, otherwise it depends on what app gets executed first and apps that rely on the dependency of other apps in app.php may break. --- lib/private/app.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/private/app.php b/lib/private/app.php index f6a81f9945f..58ae770fe25 100644 --- a/lib/private/app.php +++ b/lib/private/app.php @@ -101,6 +101,12 @@ class OC_App { } // Load the enabled apps here $apps = self::getEnabledApps(); + + // Add each apps' folder as allowed class path + foreach($apps as $app) { + \OC::$loader->addValidRoot(self::getAppPath($app)); + } + // prevent app.php from printing output ob_start(); foreach ($apps as $app) { @@ -122,7 +128,6 @@ class OC_App { */ public static function loadApp($app, $checkUpgrade = true) { self::$loadedApps[] = $app; - \OC::$loader->addValidRoot(self::getAppPath($app)); if (is_file(self::getAppPath($app) . '/appinfo/app.php')) { \OC::$server->getEventLogger()->start('load_app_' . $app, 'Load app: ' . $app); if ($checkUpgrade and self::shouldUpgrade($app)) {