diff options
author | Robin McCorkell <rmccorkell@owncloud.com> | 2015-08-12 21:43:29 +0100 |
---|---|---|
committer | Robin McCorkell <rmccorkell@owncloud.com> | 2015-08-19 10:08:23 +0100 |
commit | c592e24c871f0f6a8d688c5c93e769b1505e4b6d (patch) | |
tree | 0b967704610d193c1296ae623ab2b7212e87e2d0 /apps/files_external/lib | |
parent | 97dbc79c16ba9d4d6c361d6f397908ef7893954d (diff) | |
download | nextcloud-server-c592e24c871f0f6a8d688c5c93e769b1505e4b6d.tar.gz nextcloud-server-c592e24c871f0f6a8d688c5c93e769b1505e4b6d.zip |
Make Application a singleton
The same Application must be used in the settings templates and in
routes, so that any registered backends are correctly seen
Diffstat (limited to 'apps/files_external/lib')
-rw-r--r-- | apps/files_external/lib/config.php | 31 |
1 files changed, 11 insertions, 20 deletions
diff --git a/apps/files_external/lib/config.php b/apps/files_external/lib/config.php index 6fdf050fb60..5c38a3ba0cb 100644 --- a/apps/files_external/lib/config.php +++ b/apps/files_external/lib/config.php @@ -32,7 +32,7 @@ */ use phpseclib\Crypt\AES; -use \OCP\AppFramework\IAppContainer; +use \OCA\Files_External\Appinfo\Application; use \OCA\Files_External\Lib\BackendConfig; use \OCA\Files_External\Service\BackendService; use \OCA\Files_External\Lib\Backend\LegacyBackend; @@ -56,17 +56,8 @@ class OC_Mount_Config { // whether to skip backend test (for unit tests, as this static class is not mockable) public static $skipTest = false; - /** @var IAppContainer */ - private static $appContainer; - - /** - * Teach OC_Mount_Config about the AppFramework - * - * @param IAppContainer $appContainer - */ - public static function initApp(IAppContainer $appContainer) { - self::$appContainer = $appContainer; - } + /** @var Application */ + public static $app; /** * @param string $class @@ -75,8 +66,8 @@ class OC_Mount_Config { * @deprecated 8.2.0 use \OCA\Files_External\Service\BackendService::registerBackend() */ public static function registerBackend($class, $definition) { - $backendService = self::$appContainer->query('OCA\Files_External\Service\BackendService'); - $auth = self::$appContainer->query('OCA\Files_External\Lib\Auth\Builtin'); + $backendService = self::$app->getContainer()->query('OCA\Files_External\Service\BackendService'); + $auth = self::$app->getContainer()->query('OCA\Files_External\Lib\Auth\Builtin'); $backendService->registerBackend(new LegacyBackend($class, $definition, $auth)); @@ -128,9 +119,9 @@ class OC_Mount_Config { public static function getAbsoluteMountPoints($uid) { $mountPoints = array(); - $userGlobalStoragesService = self::$appContainer->query('OCA\Files_External\Service\UserGlobalStoragesService'); - $userStoragesService = self::$appContainer->query('OCA\Files_External\Service\UserStoragesService'); - $user = self::$appContainer->query('OCP\IUserManager')->get($uid); + $userGlobalStoragesService = self::$app->getContainer()->query('OCA\Files_External\Service\UserGlobalStoragesService'); + $userStoragesService = self::$app->getContainer()->query('OCA\Files_External\Service\UserStoragesService'); + $user = self::$app->getContainer()->query('OCP\IUserManager')->get($uid); $userGlobalStoragesService->setUser($user); $userStoragesService->setUser($user); @@ -168,7 +159,7 @@ class OC_Mount_Config { */ public static function getSystemMountPoints() { $mountPoints = []; - $service = self::$appContainer->query('OCA\Files_External\Service\GlobalStoragesService'); + $service = self::$app->getContainer()->query('OCA\Files_External\Service\GlobalStoragesService'); foreach ($service->getAllStorages() as $storage) { $mountPoints[] = self::prepareMountPointEntry($storage, false); @@ -184,7 +175,7 @@ class OC_Mount_Config { */ public static function getPersonalMountPoints() { $mountPoints = []; - $service = self::$appContainer->query('OCA\Files_External\Service\UserStoragesService'); + $service = self::$app->getContainer()->query('OCA\Files_External\Service\UserStoragesService'); foreach ($service->getAllStorages() as $storage) { $mountPoints[] = self::prepareMountPointEntry($storage, true); @@ -533,7 +524,7 @@ class OC_Mount_Config { return false; } - $service = self::$appContainer->query('OCA\Files_External\Service\BackendService'); + $service = self::$app->getContainer()->query('OCA\Files_External\Service\BackendService'); $class = $service->getBackend($options['backend'])->getStorageClass(); try { /** @var \OC\Files\Storage\Storage $storage */ |