Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

load app type only once #28214

Merged
merged 1 commit into from
Jun 29, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions lib/private/legacy/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ class OC_App {
static private $appInfo = [];
static private $appTypes = [];
static private $loadedApps = [];
static private $loadedTypes = [];
static private $altLogin = [];
const officialApp = 200;
const approvedApp = 100;
Expand Down Expand Up @@ -100,6 +101,9 @@ public static function isAppLoaded($app) {
* if $types is set, only apps of those types will be loaded
*/
public static function loadApps($types = null) {
if (is_array($types) && !array_diff($types, self::$loadedTypes)) {
return true;
}
if (\OC::$server->getSystemConfig()->getValue('maintenance', false)) {
return false;
}
Expand All @@ -108,6 +112,9 @@ public static function loadApps($types = null) {

// Add each apps' folder as allowed class path
foreach($apps as $app) {
if (self::isAppLoaded($app)) {
continue;
}
$path = self::getAppPath($app);
if($path !== false) {
self::registerAutoloading($app, $path);
Expand All @@ -132,6 +139,9 @@ public static function loadApps($types = null) {
}
}
}
if (is_array($types)) {
self::$loadedTypes = array_merge(self::$loadedTypes, $types);
}

\OC_Hook::emit('OC_App', 'loadedApps');
return true;
Expand Down