diff options
author | Robin McCorkell <rmccorkell@owncloud.com> | 2015-09-16 10:47:46 +0100 |
---|---|---|
committer | Robin McCorkell <rmccorkell@owncloud.com> | 2015-09-16 10:48:03 +0100 |
commit | 862afd80b36b64262dcce03f15886d81b88080ae (patch) | |
tree | 1348fb27121320b69f3948535591cd1c02c2e7a4 /lib | |
parent | 41e79675c3f2409df13a2b06f0ad9d55fa0ec5ad (diff) | |
download | nextcloud-server-862afd80b36b64262dcce03f15886d81b88080ae.tar.gz nextcloud-server-862afd80b36b64262dcce03f15886d81b88080ae.zip |
Restore loadApp() autoload registration
Also changes the autoloader validRoots into a hashmap to try and reduce
duplicate entries
Diffstat (limited to 'lib')
-rw-r--r-- | lib/autoloader.php | 9 | ||||
-rw-r--r-- | lib/private/app.php | 1 |
2 files changed, 7 insertions, 3 deletions
diff --git a/lib/autoloader.php b/lib/autoloader.php index 41a040b3f54..8361f31b038 100644 --- a/lib/autoloader.php +++ b/lib/autoloader.php @@ -51,7 +51,9 @@ class Autoloader { * @param string[] $validRoots */ public function __construct(array $validRoots) { - $this->validRoots = $validRoots; + foreach ($validRoots as $root) { + $this->validRoots[$root] = true; + } } /** @@ -60,7 +62,8 @@ class Autoloader { * @param string $root */ public function addValidRoot($root) { - $this->validRoots[] = stream_resolve_include_path($root); + $root = stream_resolve_include_path($root); + $this->validRoots[$root] = true; } /** @@ -126,7 +129,7 @@ class Autoloader { } protected function isValidPath($fullPath) { - foreach ($this->validRoots as $root) { + foreach ($this->validRoots as $root => $true) { if (substr($fullPath, 0, strlen($root) + 1) === $root . '/') { return true; } diff --git a/lib/private/app.php b/lib/private/app.php index e42fba525e4..368b3220b49 100644 --- a/lib/private/app.php +++ b/lib/private/app.php @@ -131,6 +131,7 @@ class OC_App { */ public static function loadApp($app, $checkUpgrade = true) { self::$loadedApps[] = $app; + \OC::$loader->addValidRoot(self::getAppPath($app)); // in case someone calls loadApp() directly 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)) { |