diff options
Diffstat (limited to 'apps/files_external/lib/MountConfig.php')
-rw-r--r-- | apps/files_external/lib/MountConfig.php | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/apps/files_external/lib/MountConfig.php b/apps/files_external/lib/MountConfig.php index ca14275ab13..5637ee71ec1 100644 --- a/apps/files_external/lib/MountConfig.php +++ b/apps/files_external/lib/MountConfig.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -16,7 +17,10 @@ use OCA\Files_External\Service\UserGlobalStoragesService; use OCA\Files_External\Service\UserStoragesService; use OCP\AppFramework\QueryException; use OCP\Files\StorageNotAvailableException; +use OCP\IConfig; use OCP\IL10N; +use OCP\Security\ISecureRandom; +use OCP\Server; use OCP\Util; use phpseclib\Crypt\AES; use Psr\Log\LoggerInterface; @@ -51,7 +55,7 @@ class MountConfig { */ public static function substitutePlaceholdersInConfig($input, ?string $userId = null) { /** @var BackendService $backendService */ - $backendService = \OC::$server->get(BackendService::class); + $backendService = Server::get(BackendService::class); /** @var IConfigHandler[] $handlers */ $handlers = $backendService->getConfigHandlers(); foreach ($handlers as $handler) { @@ -72,7 +76,7 @@ class MountConfig { * @return int see self::STATUS_* * @throws \Exception */ - public static function getBackendStatus($class, $options, $isPersonal, $testOnly = true) { + public static function getBackendStatus($class, $options) { if (self::$skipTest) { return StorageNotAvailableException::STATUS_SUCCESS; } @@ -89,7 +93,7 @@ class MountConfig { $storage = new $class($options); try { - $result = $storage->test($isPersonal, $testOnly); + $result = $storage->test(); $storage->setAvailability($result); if ($result) { return StorageNotAvailableException::STATUS_SUCCESS; @@ -99,7 +103,7 @@ class MountConfig { throw $e; } } catch (\Exception $exception) { - \OC::$server->get(LoggerInterface::class)->error($exception->getMessage(), ['exception' => $exception, 'app' => 'files_external']); + Server::get(LoggerInterface::class)->error($exception->getMessage(), ['exception' => $exception, 'app' => 'files_external']); throw $exception; } } @@ -191,7 +195,7 @@ class MountConfig { */ private static function encryptPassword($password) { $cipher = self::getCipher(); - $iv = \OC::$server->getSecureRandom()->generate(16); + $iv = Server::get(ISecureRandom::class)->generate(16); $cipher->setIV($iv); return base64_encode($iv . $cipher->encrypt($password)); } @@ -218,7 +222,7 @@ class MountConfig { */ private static function getCipher() { $cipher = new AES(AES::MODE_CBC); - $cipher->setKey(\OC::$server->getConfig()->getSystemValue('passwordsalt', null)); + $cipher->setKey(Server::get(IConfig::class)->getSystemValue('passwordsalt', null)); return $cipher; } |