From db16dc66447f15429561213d9825673f047a5202 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 10 May 2016 11:49:55 +0200 Subject: [PATCH] Correctly register autoloading before install.php and loading commands --- lib/private/Console/Application.php | 2 +- lib/private/Installer.php | 2 +- lib/private/legacy/app.php | 3 ++- tests/settings/controller/EncryptionControllerTest.php | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/private/Console/Application.php b/lib/private/Console/Application.php index 7f12db4eca..dd5111743f 100644 --- a/lib/private/Console/Application.php +++ b/lib/private/Console/Application.php @@ -98,7 +98,7 @@ class Application { if($appPath === false) { continue; } - \OC::$loader->addValidRoot($appPath); + \OC_App::registerAutoloading($app, $appPath); $file = $appPath . '/appinfo/register_command.php'; if (file_exists($file)) { require $file; diff --git a/lib/private/Installer.php b/lib/private/Installer.php index edc6306b8f..336fa0acef 100644 --- a/lib/private/Installer.php +++ b/lib/private/Installer.php @@ -564,7 +564,7 @@ class Installer { } //run appinfo/install.php - \OC::$loader->addValidRoot($appPath); + \OC_App::registerAutoloading($app, $appPath); self::includeAppScript("$appPath/appinfo/install.php"); $info = OC_App::getAppInfo($app); diff --git a/lib/private/legacy/app.php b/lib/private/legacy/app.php index dab4c1a70c..f558c87355 100644 --- a/lib/private/legacy/app.php +++ b/lib/private/legacy/app.php @@ -159,10 +159,11 @@ class OC_App { } /** + * @internal * @param string $app * @param string $path */ - protected static function registerAutoloading($app, $path) { + public static function registerAutoloading($app, $path) { // Register on PSR-4 composer autoloader $appNamespace = \OC\AppFramework\App::buildAppNamespace($app); \OC::$composerAutoloader->addPsr4($appNamespace . '\\', $path . '/lib/', true); diff --git a/tests/settings/controller/EncryptionControllerTest.php b/tests/settings/controller/EncryptionControllerTest.php index a3bb4c45a2..565aaf29c9 100644 --- a/tests/settings/controller/EncryptionControllerTest.php +++ b/tests/settings/controller/EncryptionControllerTest.php @@ -91,7 +91,7 @@ class EncryptionControllerTest extends TestCase { public function testStartMigrationSuccessful() { // we need to be able to autoload the class we're mocking - \OC::$loader->addValidRoot(\OC_App::getAppPath('encryption')); + \OC_App::registerAutoloading('encryption', \OC_App::getAppPath('encryption')); $migration = $this->getMockBuilder('\\OCA\\Encryption\\Migration') ->disableOriginalConstructor()->getMock();