Merge pull request #19086 from owncloud/restore-loadapp-autoload
Restore loadApp() autoload registration
This commit is contained in:
commit
a1e343ae7c
|
@ -51,7 +51,9 @@ class Autoloader {
|
||||||
* @param string[] $validRoots
|
* @param string[] $validRoots
|
||||||
*/
|
*/
|
||||||
public function __construct(array $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
|
* @param string $root
|
||||||
*/
|
*/
|
||||||
public function addValidRoot($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) {
|
protected function isValidPath($fullPath) {
|
||||||
foreach ($this->validRoots as $root) {
|
foreach ($this->validRoots as $root => $true) {
|
||||||
if (substr($fullPath, 0, strlen($root) + 1) === $root . '/') {
|
if (substr($fullPath, 0, strlen($root) + 1) === $root . '/') {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -131,6 +131,7 @@ class OC_App {
|
||||||
*/
|
*/
|
||||||
public static function loadApp($app, $checkUpgrade = true) {
|
public static function loadApp($app, $checkUpgrade = true) {
|
||||||
self::$loadedApps[] = $app;
|
self::$loadedApps[] = $app;
|
||||||
|
\OC::$loader->addValidRoot(self::getAppPath($app)); // in case someone calls loadApp() directly
|
||||||
if (is_file(self::getAppPath($app) . '/appinfo/app.php')) {
|
if (is_file(self::getAppPath($app) . '/appinfo/app.php')) {
|
||||||
\OC::$server->getEventLogger()->start('load_app_' . $app, 'Load app: ' . $app);
|
\OC::$server->getEventLogger()->start('load_app_' . $app, 'Load app: ' . $app);
|
||||||
if ($checkUpgrade and self::shouldUpgrade($app)) {
|
if ($checkUpgrade and self::shouldUpgrade($app)) {
|
||||||
|
|
Loading…
Reference in New Issue