Merge pull request #1021 from nextcloud/stable10-1017

Cache registered autoloaders
This commit is contained in:
Roeland Jago Douma 2016-08-23 12:24:36 +02:00 committed by GitHub
commit 94b84f2d1e
1 changed files with 6 additions and 0 deletions

View File

@ -66,6 +66,7 @@ class OC_App {
static private $appTypes = array();
static private $loadedApps = array();
static private $altLogin = array();
static private $alreadyRegistered = [];
const officialApp = 200;
/**
@ -167,6 +168,11 @@ class OC_App {
* @param string $path
*/
public static function registerAutoloading($app, $path) {
$key = $app . '-' . $path;
if(isset(self::$alreadyRegistered[$key])) {
return;
}
self::$alreadyRegistered[$key] = true;
// Register on PSR-4 composer autoloader
$appNamespace = \OC\AppFramework\App::buildAppNamespace($app);
\OC::$composerAutoloader->addPsr4($appNamespace . '\\', $path . '/lib/', true);