|
|
|
|
@ -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 */ |
|
|
|
|
|