diff options
Diffstat (limited to 'apps/files_external/lib/Service/BackendService.php')
-rw-r--r-- | apps/files_external/lib/Service/BackendService.php | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/apps/files_external/lib/Service/BackendService.php b/apps/files_external/lib/Service/BackendService.php index b452b27e175..586ce5330ad 100644 --- a/apps/files_external/lib/Service/BackendService.php +++ b/apps/files_external/lib/Service/BackendService.php @@ -7,14 +7,15 @@ namespace OCA\Files_External\Service; use OCA\Files_External\Config\IConfigHandler; +use OCA\Files_External\ConfigLexicon; use OCA\Files_External\Lib\Auth\AuthMechanism; use OCA\Files_External\Lib\Backend\Backend; - use OCA\Files_External\Lib\Config\IAuthMechanismProvider; use OCA\Files_External\Lib\Config\IBackendProvider; +use OCA\Files_External\Lib\MissingDependency; use OCP\EventDispatcher\GenericEvent; use OCP\EventDispatcher\IEventDispatcher; -use OCP\IConfig; +use OCP\IAppConfig; use OCP\Server; /** @@ -56,19 +57,12 @@ class BackendService { private $configHandlers = []; - /** - * @param IConfig $config - */ public function __construct( - protected IConfig $config, + protected IAppConfig $appConfig, ) { // Load config values - if ($this->config->getAppValue('files_external', 'allow_user_mounting', 'yes') !== 'yes') { - $this->userMountingAllowed = false; - } - $this->userMountingBackends = explode(',', - $this->config->getAppValue('files_external', 'user_mounting_backends', '') - ); + $this->userMountingAllowed = $appConfig->getValueBool('files_external', ConfigLexicon::ALLOW_USER_MOUNTING); + $this->userMountingBackends = explode(',', $appConfig->getValueString('files_external', ConfigLexicon::USER_MOUNTING_BACKENDS)); // if no backend is in the list an empty string is in the array and user mounting is disabled if ($this->userMountingBackends === ['']) { @@ -194,7 +188,8 @@ class BackendService { */ public function getAvailableBackends() { return array_filter($this->getBackends(), function ($backend) { - return !$backend->checkDependencies(); + $missing = array_filter($backend->checkDependencies(), fn (MissingDependency $dependency) => !$dependency->isOptional()); + return count($missing) === 0; }); } |