Skip to content

Commit

Permalink
Merge pull request #29428 from owncloud/stable10-6d5eab319a670da1a11c…
Browse files Browse the repository at this point in the history
…de4dbb3b1feaa6652f5e

[stable10] load app type only once
  • Loading branch information
Vincent Petry committed Nov 6, 2017
2 parents b42b3a1 + 22c0ee9 commit dca2f1e
Showing 1 changed file with 10 additions and 0 deletions.
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

0 comments on commit dca2f1e

Please sign in to comment.