aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_external/lib
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_external/lib')
-rw-r--r--apps/files_external/lib/AppInfo/Application.php3
-rw-r--r--apps/files_external/lib/Command/Applicable.php1
-rw-r--r--apps/files_external/lib/Command/Backends.php3
-rw-r--r--apps/files_external/lib/Command/Config.php1
-rw-r--r--apps/files_external/lib/Command/Create.php1
-rw-r--r--apps/files_external/lib/Command/Delete.php1
-rw-r--r--apps/files_external/lib/Command/Dependencies.php57
-rw-r--r--apps/files_external/lib/Command/Export.php1
-rw-r--r--apps/files_external/lib/Command/Import.php9
-rw-r--r--apps/files_external/lib/Command/ListCommand.php1
-rw-r--r--apps/files_external/lib/Command/Option.php1
-rw-r--r--apps/files_external/lib/Command/Scan.php28
-rw-r--r--apps/files_external/lib/Command/Verify.php1
-rw-r--r--apps/files_external/lib/Config/ConfigAdapter.php1
-rw-r--r--apps/files_external/lib/Config/ExternalMountPoint.php1
-rw-r--r--apps/files_external/lib/Config/IConfigHandler.php1
-rw-r--r--apps/files_external/lib/Config/SimpleSubstitutionTrait.php1
-rw-r--r--apps/files_external/lib/Config/UserContext.php1
-rw-r--r--apps/files_external/lib/Config/UserPlaceholderHandler.php1
-rw-r--r--apps/files_external/lib/ConfigLexicon.php41
-rw-r--r--apps/files_external/lib/Controller/AjaxController.php1
-rw-r--r--apps/files_external/lib/Controller/GlobalStoragesController.php1
-rw-r--r--apps/files_external/lib/Controller/StoragesController.php1
-rw-r--r--apps/files_external/lib/Controller/UserGlobalStoragesController.php1
-rw-r--r--apps/files_external/lib/Controller/UserStoragesController.php1
-rw-r--r--apps/files_external/lib/Lib/Auth/AmazonS3/AccessKey.php1
-rw-r--r--apps/files_external/lib/Lib/Auth/AuthMechanism.php1
-rw-r--r--apps/files_external/lib/Lib/Auth/Builtin.php1
-rw-r--r--apps/files_external/lib/Lib/Auth/IUserProvided.php1
-rw-r--r--apps/files_external/lib/Lib/Auth/InvalidAuth.php1
-rw-r--r--apps/files_external/lib/Lib/Auth/NullMechanism.php1
-rw-r--r--apps/files_external/lib/Lib/Auth/OAuth1/OAuth1.php10
-rw-r--r--apps/files_external/lib/Lib/Auth/OAuth2/OAuth2.php7
-rw-r--r--apps/files_external/lib/Lib/Auth/OpenStack/OpenStackV2.php1
-rw-r--r--apps/files_external/lib/Lib/Auth/OpenStack/Rackspace.php1
-rw-r--r--apps/files_external/lib/Lib/Auth/Password/GlobalAuth.php1
-rw-r--r--apps/files_external/lib/Lib/Auth/Password/LoginCredentials.php5
-rw-r--r--apps/files_external/lib/Lib/Auth/Password/Password.php1
-rw-r--r--apps/files_external/lib/Lib/Auth/Password/SessionCredentials.php5
-rw-r--r--apps/files_external/lib/Lib/Auth/Password/UserProvided.php1
-rw-r--r--apps/files_external/lib/Lib/Auth/PublicKey/RSA.php4
-rw-r--r--apps/files_external/lib/Lib/Auth/PublicKey/RSAPrivateKey.php1
-rw-r--r--apps/files_external/lib/Lib/Auth/SMB/KerberosAuth.php1
-rw-r--r--apps/files_external/lib/Lib/Backend/AmazonS3.php1
-rw-r--r--apps/files_external/lib/Lib/Backend/Backend.php1
-rw-r--r--apps/files_external/lib/Lib/Backend/DAV.php1
-rw-r--r--apps/files_external/lib/Lib/Backend/FTP.php1
-rw-r--r--apps/files_external/lib/Lib/Backend/InvalidBackend.php1
-rw-r--r--apps/files_external/lib/Lib/Backend/LegacyBackend.php5
-rw-r--r--apps/files_external/lib/Lib/Backend/Local.php1
-rw-r--r--apps/files_external/lib/Lib/Backend/OwnCloud.php1
-rw-r--r--apps/files_external/lib/Lib/Backend/SFTP.php1
-rw-r--r--apps/files_external/lib/Lib/Backend/SFTP_Key.php1
-rw-r--r--apps/files_external/lib/Lib/Backend/SMB.php29
-rw-r--r--apps/files_external/lib/Lib/Backend/SMB_OC.php1
-rw-r--r--apps/files_external/lib/Lib/Backend/Swift.php1
-rw-r--r--apps/files_external/lib/Lib/Config/IAuthMechanismProvider.php1
-rw-r--r--apps/files_external/lib/Lib/Config/IBackendProvider.php1
-rw-r--r--apps/files_external/lib/Lib/DefinitionParameter.php3
-rw-r--r--apps/files_external/lib/Lib/DependencyTrait.php1
-rw-r--r--apps/files_external/lib/Lib/FrontendDefinitionTrait.php1
-rw-r--r--apps/files_external/lib/Lib/IFrontendDefinition.php1
-rw-r--r--apps/files_external/lib/Lib/IIdentifier.php1
-rw-r--r--apps/files_external/lib/Lib/IdentifierTrait.php1
-rw-r--r--apps/files_external/lib/Lib/InsufficientDataForMeaningfulAnswerException.php1
-rw-r--r--apps/files_external/lib/Lib/LegacyDependencyCheckPolyfill.php1
-rw-r--r--apps/files_external/lib/Lib/MissingDependency.php14
-rw-r--r--apps/files_external/lib/Lib/Notify/SMBNotifyHandler.php1
-rw-r--r--apps/files_external/lib/Lib/PersonalMount.php1
-rw-r--r--apps/files_external/lib/Lib/PriorityTrait.php1
-rw-r--r--apps/files_external/lib/Lib/SessionStorageWrapper.php1
-rw-r--r--apps/files_external/lib/Lib/Storage/AmazonS3.php1
-rw-r--r--apps/files_external/lib/Lib/Storage/FTP.php1
-rw-r--r--apps/files_external/lib/Lib/Storage/OwnCloud.php1
-rw-r--r--apps/files_external/lib/Lib/Storage/SFTP.php1
-rw-r--r--apps/files_external/lib/Lib/Storage/SMB.php11
-rw-r--r--apps/files_external/lib/Lib/Storage/StreamWrapper.php1
-rw-r--r--apps/files_external/lib/Lib/Storage/Swift.php26
-rw-r--r--apps/files_external/lib/Lib/StorageConfig.php1
-rw-r--r--apps/files_external/lib/Lib/StorageModifierTrait.php1
-rw-r--r--apps/files_external/lib/Lib/VisibilityTrait.php1
-rw-r--r--apps/files_external/lib/Listener/LoadAdditionalListener.php7
-rw-r--r--apps/files_external/lib/Migration/DummyUserSession.php1
-rw-r--r--apps/files_external/lib/MountConfig.php1
-rw-r--r--apps/files_external/lib/NotFoundException.php1
-rw-r--r--apps/files_external/lib/Service/BackendService.php26
-rw-r--r--apps/files_external/lib/Service/DBConfigService.php1
-rw-r--r--apps/files_external/lib/Service/GlobalStoragesService.php1
-rw-r--r--apps/files_external/lib/Service/ImportLegacyStoragesService.php1
-rw-r--r--apps/files_external/lib/Service/LegacyStoragesService.php1
-rw-r--r--apps/files_external/lib/Service/StoragesService.php1
-rw-r--r--apps/files_external/lib/Service/UserGlobalStoragesService.php1
-rw-r--r--apps/files_external/lib/Service/UserStoragesService.php1
-rw-r--r--apps/files_external/lib/Service/UserTrait.php1
-rw-r--r--apps/files_external/lib/Settings/Admin.php1
-rw-r--r--apps/files_external/lib/Settings/Personal.php1
-rw-r--r--apps/files_external/lib/Settings/PersonalSection.php1
-rw-r--r--apps/files_external/lib/Settings/Section.php1
98 files changed, 313 insertions, 59 deletions
diff --git a/apps/files_external/lib/AppInfo/Application.php b/apps/files_external/lib/AppInfo/Application.php
index 761fc97b7aa..d5181e783ce 100644
--- a/apps/files_external/lib/AppInfo/Application.php
+++ b/apps/files_external/lib/AppInfo/Application.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
@@ -9,6 +10,7 @@ namespace OCA\Files_External\AppInfo;
use OCA\Files\Event\LoadAdditionalScriptsEvent;
use OCA\Files_External\Config\ConfigAdapter;
use OCA\Files_External\Config\UserPlaceholderHandler;
+use OCA\Files_External\ConfigLexicon;
use OCA\Files_External\Lib\Auth\AmazonS3\AccessKey;
use OCA\Files_External\Lib\Auth\Builtin;
use OCA\Files_External\Lib\Auth\NullMechanism;
@@ -73,6 +75,7 @@ class Application extends App implements IBackendProvider, IAuthMechanismProvide
$context->registerEventListener(UserDeletedEvent::class, UserDeletedListener::class);
$context->registerEventListener(GroupDeletedEvent::class, GroupDeletedListener::class);
$context->registerEventListener(LoadAdditionalScriptsEvent::class, LoadAdditionalListener::class);
+ $context->registerConfigLexicon(ConfigLexicon::class);
}
public function boot(IBootContext $context): void {
diff --git a/apps/files_external/lib/Command/Applicable.php b/apps/files_external/lib/Command/Applicable.php
index ecb635c052a..4d5e264bfaf 100644
--- a/apps/files_external/lib/Command/Applicable.php
+++ b/apps/files_external/lib/Command/Applicable.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
diff --git a/apps/files_external/lib/Command/Backends.php b/apps/files_external/lib/Command/Backends.php
index c2d844dc781..7fab0477adf 100644
--- a/apps/files_external/lib/Command/Backends.php
+++ b/apps/files_external/lib/Command/Backends.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
@@ -94,7 +95,7 @@ class Backends extends Base {
*/
private function formatConfiguration(array $parameters): array {
$configuration = array_filter($parameters, function (DefinitionParameter $parameter) {
- return $parameter->getType() !== DefinitionParameter::VALUE_HIDDEN;
+ return $parameter->isFlagSet(DefinitionParameter::FLAG_HIDDEN);
});
return array_map(function (DefinitionParameter $parameter) {
return $parameter->getTypeName();
diff --git a/apps/files_external/lib/Command/Config.php b/apps/files_external/lib/Command/Config.php
index 0736749f6d9..883b4a2f3e7 100644
--- a/apps/files_external/lib/Command/Config.php
+++ b/apps/files_external/lib/Command/Config.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
diff --git a/apps/files_external/lib/Command/Create.php b/apps/files_external/lib/Command/Create.php
index 4396d2e2b13..3307015518a 100644
--- a/apps/files_external/lib/Command/Create.php
+++ b/apps/files_external/lib/Command/Create.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
diff --git a/apps/files_external/lib/Command/Delete.php b/apps/files_external/lib/Command/Delete.php
index 3e6ccf751a8..9f121250f7d 100644
--- a/apps/files_external/lib/Command/Delete.php
+++ b/apps/files_external/lib/Command/Delete.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
diff --git a/apps/files_external/lib/Command/Dependencies.php b/apps/files_external/lib/Command/Dependencies.php
new file mode 100644
index 00000000000..d2db8a8c9af
--- /dev/null
+++ b/apps/files_external/lib/Command/Dependencies.php
@@ -0,0 +1,57 @@
+<?php
+
+/**
+ * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-only
+ */
+namespace OCA\Files_External\Command;
+
+use OC\Core\Command\Base;
+use OCA\Files_External\Service\BackendService;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Output\OutputInterface;
+
+class Dependencies extends Base {
+ public function __construct(
+ private readonly BackendService $backendService,
+ ) {
+ parent::__construct();
+ }
+
+ protected function configure(): void {
+ $this
+ ->setName('files_external:dependencies')
+ ->setDescription('Show information about the backend dependencies');
+ parent::configure();
+ }
+
+ protected function execute(InputInterface $input, OutputInterface $output): int {
+ $storageBackends = $this->backendService->getBackends();
+
+ $anyMissing = false;
+
+ foreach ($storageBackends as $backend) {
+ if ($backend->getDeprecateTo() !== null) {
+ continue;
+ }
+ $missingDependencies = $backend->checkDependencies();
+ if ($missingDependencies) {
+ $anyMissing = true;
+ $output->writeln($backend->getText() . ':');
+ foreach ($missingDependencies as $missingDependency) {
+ if ($missingDependency->getMessage()) {
+ $output->writeln(" - <comment>{$missingDependency->getDependency()}</comment>: {$missingDependency->getMessage()}");
+ } else {
+ $output->writeln(" - <comment>{$missingDependency->getDependency()}</comment>");
+ }
+ }
+ }
+ }
+
+ if (!$anyMissing) {
+ $output->writeln('<info>All dependencies are met</info>');
+ }
+
+ return self::SUCCESS;
+ }
+}
diff --git a/apps/files_external/lib/Command/Export.php b/apps/files_external/lib/Command/Export.php
index 0735d94d89d..59484d0e788 100644
--- a/apps/files_external/lib/Command/Export.php
+++ b/apps/files_external/lib/Command/Export.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
diff --git a/apps/files_external/lib/Command/Import.php b/apps/files_external/lib/Command/Import.php
index bf36bf5d5c1..a9ed76fbe40 100644
--- a/apps/files_external/lib/Command/Import.php
+++ b/apps/files_external/lib/Command/Import.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
@@ -112,10 +113,10 @@ class Import extends Base {
foreach ($mounts as $mount) {
foreach ($existingMounts as $existingMount) {
if (
- $existingMount->getMountPoint() === $mount->getMountPoint() &&
- $existingMount->getApplicableGroups() === $mount->getApplicableGroups() &&
- $existingMount->getApplicableUsers() === $mount->getApplicableUsers() &&
- $existingMount->getBackendOptions() === $mount->getBackendOptions()
+ $existingMount->getMountPoint() === $mount->getMountPoint()
+ && $existingMount->getApplicableGroups() === $mount->getApplicableGroups()
+ && $existingMount->getApplicableUsers() === $mount->getApplicableUsers()
+ && $existingMount->getBackendOptions() === $mount->getBackendOptions()
) {
$output->writeln('<error>Duplicate mount (' . $mount->getMountPoint() . ')</error>');
return self::FAILURE;
diff --git a/apps/files_external/lib/Command/ListCommand.php b/apps/files_external/lib/Command/ListCommand.php
index 84c1b569e9d..350916b6c2c 100644
--- a/apps/files_external/lib/Command/ListCommand.php
+++ b/apps/files_external/lib/Command/ListCommand.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
diff --git a/apps/files_external/lib/Command/Option.php b/apps/files_external/lib/Command/Option.php
index 6051c9c5fbd..3fda3fcb3cf 100644
--- a/apps/files_external/lib/Command/Option.php
+++ b/apps/files_external/lib/Command/Option.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
diff --git a/apps/files_external/lib/Command/Scan.php b/apps/files_external/lib/Command/Scan.php
index bd54415df55..75d98878baa 100644
--- a/apps/files_external/lib/Command/Scan.php
+++ b/apps/files_external/lib/Command/Scan.php
@@ -11,6 +11,7 @@ namespace OCA\Files_External\Command;
use OC\Files\Cache\Scanner;
use OCA\Files_External\Service\GlobalStoragesService;
use OCP\IUserManager;
+use OCP\Lock\LockedException;
use Symfony\Component\Console\Helper\Table;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
@@ -53,6 +54,11 @@ class Scan extends StorageAuthBase {
InputOption::VALUE_OPTIONAL,
'The path in the storage to scan',
''
+ )->addOption(
+ 'unscanned',
+ '',
+ InputOption::VALUE_NONE,
+ 'only scan files which are marked as not fully scanned'
);
parent::configure();
}
@@ -82,7 +88,27 @@ class Scan extends StorageAuthBase {
$this->abortIfInterrupted();
});
- $scanner->scan($path);
+ try {
+ if ($input->getOption('unscanned')) {
+ if ($path !== '') {
+ $output->writeln('<error>--unscanned is mutually exclusive with --path</error>');
+ return 1;
+ }
+ $scanner->backgroundScan();
+ } else {
+ $scanner->scan($path);
+ }
+ } catch (LockedException $e) {
+ if (is_string($e->getReadablePath()) && str_starts_with($e->getReadablePath(), 'scanner::')) {
+ if ($e->getReadablePath() === 'scanner::') {
+ $output->writeln('<error>Another process is already scanning this storage</error>');
+ } else {
+ $output->writeln('<error>Another process is already scanning \'' . substr($e->getReadablePath(), strlen('scanner::')) . '\' in this storage</error>');
+ }
+ } else {
+ throw $e;
+ }
+ }
$this->presentStats($output);
diff --git a/apps/files_external/lib/Command/Verify.php b/apps/files_external/lib/Command/Verify.php
index 32c94fc582a..18cbc5a6774 100644
--- a/apps/files_external/lib/Command/Verify.php
+++ b/apps/files_external/lib/Command/Verify.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
diff --git a/apps/files_external/lib/Config/ConfigAdapter.php b/apps/files_external/lib/Config/ConfigAdapter.php
index db53c8cf6c9..a46c0fd5c66 100644
--- a/apps/files_external/lib/Config/ConfigAdapter.php
+++ b/apps/files_external/lib/Config/ConfigAdapter.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
diff --git a/apps/files_external/lib/Config/ExternalMountPoint.php b/apps/files_external/lib/Config/ExternalMountPoint.php
index 0dc2eab5120..97569ed2913 100644
--- a/apps/files_external/lib/Config/ExternalMountPoint.php
+++ b/apps/files_external/lib/Config/ExternalMountPoint.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
diff --git a/apps/files_external/lib/Config/IConfigHandler.php b/apps/files_external/lib/Config/IConfigHandler.php
index 2f1604e232b..9e8283cc58b 100644
--- a/apps/files_external/lib/Config/IConfigHandler.php
+++ b/apps/files_external/lib/Config/IConfigHandler.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
diff --git a/apps/files_external/lib/Config/SimpleSubstitutionTrait.php b/apps/files_external/lib/Config/SimpleSubstitutionTrait.php
index 21269d7526e..85a76054fa8 100644
--- a/apps/files_external/lib/Config/SimpleSubstitutionTrait.php
+++ b/apps/files_external/lib/Config/SimpleSubstitutionTrait.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
diff --git a/apps/files_external/lib/Config/UserContext.php b/apps/files_external/lib/Config/UserContext.php
index 6fe679c60b2..fb5c79a9329 100644
--- a/apps/files_external/lib/Config/UserContext.php
+++ b/apps/files_external/lib/Config/UserContext.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
diff --git a/apps/files_external/lib/Config/UserPlaceholderHandler.php b/apps/files_external/lib/Config/UserPlaceholderHandler.php
index ec91df5fb7a..d158e6923c1 100644
--- a/apps/files_external/lib/Config/UserPlaceholderHandler.php
+++ b/apps/files_external/lib/Config/UserPlaceholderHandler.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
diff --git a/apps/files_external/lib/ConfigLexicon.php b/apps/files_external/lib/ConfigLexicon.php
new file mode 100644
index 00000000000..e162efc92cf
--- /dev/null
+++ b/apps/files_external/lib/ConfigLexicon.php
@@ -0,0 +1,41 @@
+<?php
+
+declare(strict_types=1);
+/**
+ * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+
+namespace OCA\Files_External;
+
+use NCU\Config\Lexicon\ConfigLexiconEntry;
+use NCU\Config\Lexicon\ConfigLexiconStrictness;
+use NCU\Config\Lexicon\IConfigLexicon;
+use NCU\Config\ValueType;
+
+/**
+ * Config Lexicon for files_sharing.
+ *
+ * Please Add & Manage your Config Keys in that file and keep the Lexicon up to date!
+ *
+ * {@see IConfigLexicon}
+ */
+class ConfigLexicon implements IConfigLexicon {
+ public const ALLOW_USER_MOUNTING = 'allow_user_mounting';
+ public const USER_MOUNTING_BACKENDS = 'user_mounting_backends';
+
+ public function getStrictness(): ConfigLexiconStrictness {
+ return ConfigLexiconStrictness::NOTICE;
+ }
+
+ public function getAppConfigs(): array {
+ return [
+ new ConfigLexiconEntry(self::ALLOW_USER_MOUNTING, ValueType::BOOL, false, 'allow users to mount their own external filesystems', true),
+ new ConfigLexiconEntry(self::USER_MOUNTING_BACKENDS, ValueType::STRING, '', 'list of mounting backends available for users', true),
+ ];
+ }
+
+ public function getUserConfigs(): array {
+ return [];
+ }
+}
diff --git a/apps/files_external/lib/Controller/AjaxController.php b/apps/files_external/lib/Controller/AjaxController.php
index 4d5497b73cb..5cee6422530 100644
--- a/apps/files_external/lib/Controller/AjaxController.php
+++ b/apps/files_external/lib/Controller/AjaxController.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
diff --git a/apps/files_external/lib/Controller/GlobalStoragesController.php b/apps/files_external/lib/Controller/GlobalStoragesController.php
index 466c4f6f551..132295f6b35 100644
--- a/apps/files_external/lib/Controller/GlobalStoragesController.php
+++ b/apps/files_external/lib/Controller/GlobalStoragesController.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
diff --git a/apps/files_external/lib/Controller/StoragesController.php b/apps/files_external/lib/Controller/StoragesController.php
index 72bcbd48a4c..18f8d3164b7 100644
--- a/apps/files_external/lib/Controller/StoragesController.php
+++ b/apps/files_external/lib/Controller/StoragesController.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
diff --git a/apps/files_external/lib/Controller/UserGlobalStoragesController.php b/apps/files_external/lib/Controller/UserGlobalStoragesController.php
index a7c4fc61997..5f428db9661 100644
--- a/apps/files_external/lib/Controller/UserGlobalStoragesController.php
+++ b/apps/files_external/lib/Controller/UserGlobalStoragesController.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
diff --git a/apps/files_external/lib/Controller/UserStoragesController.php b/apps/files_external/lib/Controller/UserStoragesController.php
index 6d797b5818d..7b0c858e51b 100644
--- a/apps/files_external/lib/Controller/UserStoragesController.php
+++ b/apps/files_external/lib/Controller/UserStoragesController.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
diff --git a/apps/files_external/lib/Lib/Auth/AmazonS3/AccessKey.php b/apps/files_external/lib/Lib/Auth/AmazonS3/AccessKey.php
index 04019404a90..c86c88a13d7 100644
--- a/apps/files_external/lib/Lib/Auth/AmazonS3/AccessKey.php
+++ b/apps/files_external/lib/Lib/Auth/AmazonS3/AccessKey.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
diff --git a/apps/files_external/lib/Lib/Auth/AuthMechanism.php b/apps/files_external/lib/Lib/Auth/AuthMechanism.php
index ebdf768cda3..dfe4a74b1b2 100644
--- a/apps/files_external/lib/Lib/Auth/AuthMechanism.php
+++ b/apps/files_external/lib/Lib/Auth/AuthMechanism.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
diff --git a/apps/files_external/lib/Lib/Auth/Builtin.php b/apps/files_external/lib/Lib/Auth/Builtin.php
index cd4b8a22af4..8e12a6daca6 100644
--- a/apps/files_external/lib/Lib/Auth/Builtin.php
+++ b/apps/files_external/lib/Lib/Auth/Builtin.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
diff --git a/apps/files_external/lib/Lib/Auth/IUserProvided.php b/apps/files_external/lib/Lib/Auth/IUserProvided.php
index 60f978f673d..2350d7f6db4 100644
--- a/apps/files_external/lib/Lib/Auth/IUserProvided.php
+++ b/apps/files_external/lib/Lib/Auth/IUserProvided.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
* SPDX-License-Identifier: AGPL-3.0-only
diff --git a/apps/files_external/lib/Lib/Auth/InvalidAuth.php b/apps/files_external/lib/Lib/Auth/InvalidAuth.php
index d5a6fdcbe5d..2af24f1ea07 100644
--- a/apps/files_external/lib/Lib/Auth/InvalidAuth.php
+++ b/apps/files_external/lib/Lib/Auth/InvalidAuth.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud GmbH.
diff --git a/apps/files_external/lib/Lib/Auth/NullMechanism.php b/apps/files_external/lib/Lib/Auth/NullMechanism.php
index 7847c111415..8e2e5b656b2 100644
--- a/apps/files_external/lib/Lib/Auth/NullMechanism.php
+++ b/apps/files_external/lib/Lib/Auth/NullMechanism.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
diff --git a/apps/files_external/lib/Lib/Auth/OAuth1/OAuth1.php b/apps/files_external/lib/Lib/Auth/OAuth1/OAuth1.php
index b215201b4f4..054c33f3b50 100644
--- a/apps/files_external/lib/Lib/Auth/OAuth1/OAuth1.php
+++ b/apps/files_external/lib/Lib/Auth/OAuth1/OAuth1.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
@@ -21,14 +22,17 @@ class OAuth1 extends AuthMechanism {
->setText($l->t('OAuth1'))
->addParameters([
(new DefinitionParameter('configured', 'configured'))
- ->setType(DefinitionParameter::VALUE_HIDDEN),
+ ->setType(DefinitionParameter::VALUE_TEXT)
+ ->setFlag(DefinitionParameter::FLAG_HIDDEN),
new DefinitionParameter('app_key', $l->t('App key')),
(new DefinitionParameter('app_secret', $l->t('App secret')))
->setType(DefinitionParameter::VALUE_PASSWORD),
(new DefinitionParameter('token', 'token'))
- ->setType(DefinitionParameter::VALUE_HIDDEN),
+ ->setType(DefinitionParameter::VALUE_PASSWORD)
+ ->setFlag(DefinitionParameter::FLAG_HIDDEN),
(new DefinitionParameter('token_secret', 'token_secret'))
- ->setType(DefinitionParameter::VALUE_HIDDEN),
+ ->setType(DefinitionParameter::VALUE_PASSWORD)
+ ->setFlag(DefinitionParameter::FLAG_HIDDEN),
])
->addCustomJs('oauth1')
;
diff --git a/apps/files_external/lib/Lib/Auth/OAuth2/OAuth2.php b/apps/files_external/lib/Lib/Auth/OAuth2/OAuth2.php
index 6b41fef90d5..beaf73c2344 100644
--- a/apps/files_external/lib/Lib/Auth/OAuth2/OAuth2.php
+++ b/apps/files_external/lib/Lib/Auth/OAuth2/OAuth2.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
@@ -21,12 +22,14 @@ class OAuth2 extends AuthMechanism {
->setText($l->t('OAuth2'))
->addParameters([
(new DefinitionParameter('configured', 'configured'))
- ->setType(DefinitionParameter::VALUE_HIDDEN),
+ ->setType(DefinitionParameter::VALUE_TEXT)
+ ->setFlag(DefinitionParameter::FLAG_HIDDEN),
new DefinitionParameter('client_id', $l->t('Client ID')),
(new DefinitionParameter('client_secret', $l->t('Client secret')))
->setType(DefinitionParameter::VALUE_PASSWORD),
(new DefinitionParameter('token', 'token'))
- ->setType(DefinitionParameter::VALUE_HIDDEN),
+ ->setType(DefinitionParameter::VALUE_PASSWORD)
+ ->setFlag(DefinitionParameter::FLAG_HIDDEN),
])
->addCustomJs('oauth2')
;
diff --git a/apps/files_external/lib/Lib/Auth/OpenStack/OpenStackV2.php b/apps/files_external/lib/Lib/Auth/OpenStack/OpenStackV2.php
index 3be4169831b..3b1c9f123af 100644
--- a/apps/files_external/lib/Lib/Auth/OpenStack/OpenStackV2.php
+++ b/apps/files_external/lib/Lib/Auth/OpenStack/OpenStackV2.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
diff --git a/apps/files_external/lib/Lib/Auth/OpenStack/Rackspace.php b/apps/files_external/lib/Lib/Auth/OpenStack/Rackspace.php
index a47d2ea0ca8..b1d1068e586 100644
--- a/apps/files_external/lib/Lib/Auth/OpenStack/Rackspace.php
+++ b/apps/files_external/lib/Lib/Auth/OpenStack/Rackspace.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
diff --git a/apps/files_external/lib/Lib/Auth/Password/GlobalAuth.php b/apps/files_external/lib/Lib/Auth/Password/GlobalAuth.php
index ee23c28b993..916b496b506 100644
--- a/apps/files_external/lib/Lib/Auth/Password/GlobalAuth.php
+++ b/apps/files_external/lib/Lib/Auth/Password/GlobalAuth.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2015 ownCloud, Inc.
diff --git a/apps/files_external/lib/Lib/Auth/Password/LoginCredentials.php b/apps/files_external/lib/Lib/Auth/Password/LoginCredentials.php
index e3453a477d4..ce38140b6ee 100644
--- a/apps/files_external/lib/Lib/Auth/Password/LoginCredentials.php
+++ b/apps/files_external/lib/Lib/Auth/Password/LoginCredentials.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2015 ownCloud, Inc.
@@ -43,7 +44,9 @@ class LoginCredentials extends AuthMechanism {
->setText($l->t('Log-in credentials, save in database'))
->addParameters([
(new DefinitionParameter('password', $l->t('Password')))
- ->setType(DefinitionParameter::VALUE_PASSWORD),
+ ->setType(DefinitionParameter::VALUE_PASSWORD)
+ ->setFlag(DefinitionParameter::FLAG_HIDDEN)
+ ->setFlag(DefinitionParameter::FLAG_OPTIONAL),
]);
$eventDispatcher->addServiceListener(UserLoggedInEvent::class, StorePasswordListener::class);
diff --git a/apps/files_external/lib/Lib/Auth/Password/Password.php b/apps/files_external/lib/Lib/Auth/Password/Password.php
index e3393233840..d4291148e3e 100644
--- a/apps/files_external/lib/Lib/Auth/Password/Password.php
+++ b/apps/files_external/lib/Lib/Auth/Password/Password.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
diff --git a/apps/files_external/lib/Lib/Auth/Password/SessionCredentials.php b/apps/files_external/lib/Lib/Auth/Password/SessionCredentials.php
index 6b7a51a8828..8f161073771 100644
--- a/apps/files_external/lib/Lib/Auth/Password/SessionCredentials.php
+++ b/apps/files_external/lib/Lib/Auth/Password/SessionCredentials.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
@@ -32,7 +33,9 @@ class SessionCredentials extends AuthMechanism {
->setText($l->t('Log-in credentials, save in session'))
->addParameters([
(new DefinitionParameter('password', $l->t('Password')))
- ->setType(DefinitionParameter::VALUE_PASSWORD),
+ ->setType(DefinitionParameter::VALUE_PASSWORD)
+ ->setFlag(DefinitionParameter::FLAG_HIDDEN)
+ ->setFlag(DefinitionParameter::FLAG_OPTIONAL),
]);
}
diff --git a/apps/files_external/lib/Lib/Auth/Password/UserProvided.php b/apps/files_external/lib/Lib/Auth/Password/UserProvided.php
index 7f937cf14c1..b158392f6eb 100644
--- a/apps/files_external/lib/Lib/Auth/Password/UserProvided.php
+++ b/apps/files_external/lib/Lib/Auth/Password/UserProvided.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2015 ownCloud, Inc.
diff --git a/apps/files_external/lib/Lib/Auth/PublicKey/RSA.php b/apps/files_external/lib/Lib/Auth/PublicKey/RSA.php
index 2371ce0a219..ad95c743d2d 100644
--- a/apps/files_external/lib/Lib/Auth/PublicKey/RSA.php
+++ b/apps/files_external/lib/Lib/Auth/PublicKey/RSA.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
@@ -31,7 +32,8 @@ class RSA extends AuthMechanism {
new DefinitionParameter('user', $l->t('Login')),
new DefinitionParameter('public_key', $l->t('Public key')),
(new DefinitionParameter('private_key', 'private_key'))
- ->setType(DefinitionParameter::VALUE_HIDDEN),
+ ->setType(DefinitionParameter::VALUE_PASSWORD)
+ ->setFlag(DefinitionParameter::FLAG_HIDDEN),
])
->addCustomJs('public_key')
;
diff --git a/apps/files_external/lib/Lib/Auth/PublicKey/RSAPrivateKey.php b/apps/files_external/lib/Lib/Auth/PublicKey/RSAPrivateKey.php
index 8c2e2f3d6ec..8f58b71d5ac 100644
--- a/apps/files_external/lib/Lib/Auth/PublicKey/RSAPrivateKey.php
+++ b/apps/files_external/lib/Lib/Auth/PublicKey/RSAPrivateKey.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
diff --git a/apps/files_external/lib/Lib/Auth/SMB/KerberosAuth.php b/apps/files_external/lib/Lib/Auth/SMB/KerberosAuth.php
index e7a0884d1bd..9210209192a 100644
--- a/apps/files_external/lib/Lib/Auth/SMB/KerberosAuth.php
+++ b/apps/files_external/lib/Lib/Auth/SMB/KerberosAuth.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
diff --git a/apps/files_external/lib/Lib/Backend/AmazonS3.php b/apps/files_external/lib/Lib/Backend/AmazonS3.php
index f71ca40cdfc..464b03b55e0 100644
--- a/apps/files_external/lib/Lib/Backend/AmazonS3.php
+++ b/apps/files_external/lib/Lib/Backend/AmazonS3.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
diff --git a/apps/files_external/lib/Lib/Backend/Backend.php b/apps/files_external/lib/Lib/Backend/Backend.php
index f965e246d42..f7500ee24a4 100644
--- a/apps/files_external/lib/Lib/Backend/Backend.php
+++ b/apps/files_external/lib/Lib/Backend/Backend.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
diff --git a/apps/files_external/lib/Lib/Backend/DAV.php b/apps/files_external/lib/Lib/Backend/DAV.php
index 9eb206f0272..dea9e7c5e77 100644
--- a/apps/files_external/lib/Lib/Backend/DAV.php
+++ b/apps/files_external/lib/Lib/Backend/DAV.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
diff --git a/apps/files_external/lib/Lib/Backend/FTP.php b/apps/files_external/lib/Lib/Backend/FTP.php
index cdf7d187b4d..72a8184c9b9 100644
--- a/apps/files_external/lib/Lib/Backend/FTP.php
+++ b/apps/files_external/lib/Lib/Backend/FTP.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
diff --git a/apps/files_external/lib/Lib/Backend/InvalidBackend.php b/apps/files_external/lib/Lib/Backend/InvalidBackend.php
index 6082d46bd67..48912c0e49e 100644
--- a/apps/files_external/lib/Lib/Backend/InvalidBackend.php
+++ b/apps/files_external/lib/Lib/Backend/InvalidBackend.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud GmbH.
diff --git a/apps/files_external/lib/Lib/Backend/LegacyBackend.php b/apps/files_external/lib/Lib/Backend/LegacyBackend.php
index 11396913fbd..9c7e5b01bc3 100644
--- a/apps/files_external/lib/Lib/Backend/LegacyBackend.php
+++ b/apps/files_external/lib/Lib/Backend/LegacyBackend.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
@@ -52,10 +53,6 @@ class LegacyBackend extends Backend {
$type = DefinitionParameter::VALUE_PASSWORD;
$placeholder = substr($placeholder, 1);
break;
- case '#':
- $type = DefinitionParameter::VALUE_HIDDEN;
- $placeholder = substr($placeholder, 1);
- break;
}
$this->addParameter((new DefinitionParameter($name, $placeholder))
->setType($type)
diff --git a/apps/files_external/lib/Lib/Backend/Local.php b/apps/files_external/lib/Lib/Backend/Local.php
index 2902ba770c6..56940b8e83b 100644
--- a/apps/files_external/lib/Lib/Backend/Local.php
+++ b/apps/files_external/lib/Lib/Backend/Local.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
diff --git a/apps/files_external/lib/Lib/Backend/OwnCloud.php b/apps/files_external/lib/Lib/Backend/OwnCloud.php
index c0bd6891864..0c0e2c6d300 100644
--- a/apps/files_external/lib/Lib/Backend/OwnCloud.php
+++ b/apps/files_external/lib/Lib/Backend/OwnCloud.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
diff --git a/apps/files_external/lib/Lib/Backend/SFTP.php b/apps/files_external/lib/Lib/Backend/SFTP.php
index 93a5d87a5ff..0926cf7fd93 100644
--- a/apps/files_external/lib/Lib/Backend/SFTP.php
+++ b/apps/files_external/lib/Lib/Backend/SFTP.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
diff --git a/apps/files_external/lib/Lib/Backend/SFTP_Key.php b/apps/files_external/lib/Lib/Backend/SFTP_Key.php
index a657dce66e5..278fae3fba7 100644
--- a/apps/files_external/lib/Lib/Backend/SFTP_Key.php
+++ b/apps/files_external/lib/Lib/Backend/SFTP_Key.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
diff --git a/apps/files_external/lib/Lib/Backend/SMB.php b/apps/files_external/lib/Lib/Backend/SMB.php
index c4a68fea6e1..4479ecdcaaa 100644
--- a/apps/files_external/lib/Lib/Backend/SMB.php
+++ b/apps/files_external/lib/Lib/Backend/SMB.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
@@ -10,19 +11,20 @@ namespace OCA\Files_External\Lib\Backend;
use Icewind\SMB\BasicAuth;
use Icewind\SMB\KerberosApacheAuth;
use Icewind\SMB\KerberosAuth;
+use Icewind\SMB\Native\NativeServer;
+use Icewind\SMB\Wrapped\Server;
use OCA\Files_External\Lib\Auth\AuthMechanism;
use OCA\Files_External\Lib\Auth\Password\Password;
use OCA\Files_External\Lib\Auth\SMB\KerberosApacheAuth as KerberosApacheAuthMechanism;
use OCA\Files_External\Lib\DefinitionParameter;
use OCA\Files_External\Lib\InsufficientDataForMeaningfulAnswerException;
-use OCA\Files_External\Lib\LegacyDependencyCheckPolyfill;
+use OCA\Files_External\Lib\MissingDependency;
+use OCA\Files_External\Lib\Storage\SystemBridge;
use OCA\Files_External\Lib\StorageConfig;
use OCP\IL10N;
use OCP\IUser;
class SMB extends Backend {
- use LegacyDependencyCheckPolyfill;
-
public function __construct(IL10N $l, Password $legacyAuth) {
$this
->setIdentifier('smb')
@@ -49,8 +51,9 @@ class SMB extends Backend {
->setFlag(DefinitionParameter::FLAG_OPTIONAL)
->setTooltip($l->t("Check the ACL's of each file or folder inside a directory to filter out items where the account has no read permissions, comes with a performance penalty")),
(new DefinitionParameter('timeout', $l->t('Timeout')))
- ->setType(DefinitionParameter::VALUE_HIDDEN)
- ->setFlag(DefinitionParameter::FLAG_OPTIONAL),
+ ->setType(DefinitionParameter::VALUE_TEXT)
+ ->setFlag(DefinitionParameter::FLAG_OPTIONAL)
+ ->setFlag(DefinitionParameter::FLAG_HIDDEN),
])
->addAuthScheme(AuthMechanism::SCHEME_PASSWORD)
->addAuthScheme(AuthMechanism::SCHEME_SMB)
@@ -121,4 +124,20 @@ class SMB extends Backend {
$storage->setBackendOption('auth', $smbAuth);
}
+
+ public function checkDependencies() {
+ $system = \OCP\Server::get(SystemBridge::class);
+ if (NativeServer::available($system)) {
+ return [];
+ } elseif (Server::available($system)) {
+ $missing = new MissingDependency('php-smbclient');
+ $missing->setOptional(true);
+ $missing->setMessage('The php-smbclient library provides improved compatibility and performance for SMB storages.');
+ return [$missing];
+ } else {
+ $missing = new MissingDependency('php-smbclient');
+ $missing->setMessage('Either the php-smbclient library (preferred) or the smbclient binary is required for SMB storages.');
+ return [$missing, new MissingDependency('smbclient')];
+ }
+ }
}
diff --git a/apps/files_external/lib/Lib/Backend/SMB_OC.php b/apps/files_external/lib/Lib/Backend/SMB_OC.php
index 55edec8a464..bcb8d0fbf16 100644
--- a/apps/files_external/lib/Lib/Backend/SMB_OC.php
+++ b/apps/files_external/lib/Lib/Backend/SMB_OC.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
diff --git a/apps/files_external/lib/Lib/Backend/Swift.php b/apps/files_external/lib/Lib/Backend/Swift.php
index 386604e6e1d..37527ba3dbb 100644
--- a/apps/files_external/lib/Lib/Backend/Swift.php
+++ b/apps/files_external/lib/Lib/Backend/Swift.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
diff --git a/apps/files_external/lib/Lib/Config/IAuthMechanismProvider.php b/apps/files_external/lib/Lib/Config/IAuthMechanismProvider.php
index 1d0cc3cca78..0c2e90a243c 100644
--- a/apps/files_external/lib/Lib/Config/IAuthMechanismProvider.php
+++ b/apps/files_external/lib/Lib/Config/IAuthMechanismProvider.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
diff --git a/apps/files_external/lib/Lib/Config/IBackendProvider.php b/apps/files_external/lib/Lib/Config/IBackendProvider.php
index 3f66966950d..44c460c3138 100644
--- a/apps/files_external/lib/Lib/Config/IBackendProvider.php
+++ b/apps/files_external/lib/Lib/Config/IBackendProvider.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
diff --git a/apps/files_external/lib/Lib/DefinitionParameter.php b/apps/files_external/lib/Lib/DefinitionParameter.php
index 1e611edd1ed..a73dd2df967 100644
--- a/apps/files_external/lib/Lib/DefinitionParameter.php
+++ b/apps/files_external/lib/Lib/DefinitionParameter.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
@@ -18,12 +19,12 @@ class DefinitionParameter implements \JsonSerializable {
public const VALUE_TEXT = 0;
public const VALUE_BOOLEAN = 1;
public const VALUE_PASSWORD = 2;
- public const VALUE_HIDDEN = 3;
/** Flag constants */
public const FLAG_NONE = 0;
public const FLAG_OPTIONAL = 1;
public const FLAG_USER_PROVIDED = 2;
+ public const FLAG_HIDDEN = 4;
/** @var string human-readable parameter tooltip */
private string $tooltip = '';
diff --git a/apps/files_external/lib/Lib/DependencyTrait.php b/apps/files_external/lib/Lib/DependencyTrait.php
index 1d112532128..644132b82bc 100644
--- a/apps/files_external/lib/Lib/DependencyTrait.php
+++ b/apps/files_external/lib/Lib/DependencyTrait.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
diff --git a/apps/files_external/lib/Lib/FrontendDefinitionTrait.php b/apps/files_external/lib/Lib/FrontendDefinitionTrait.php
index 5602345fe89..0f280d1d486 100644
--- a/apps/files_external/lib/Lib/FrontendDefinitionTrait.php
+++ b/apps/files_external/lib/Lib/FrontendDefinitionTrait.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
diff --git a/apps/files_external/lib/Lib/IFrontendDefinition.php b/apps/files_external/lib/Lib/IFrontendDefinition.php
index 0184d5f536c..c8b06a1c30b 100644
--- a/apps/files_external/lib/Lib/IFrontendDefinition.php
+++ b/apps/files_external/lib/Lib/IFrontendDefinition.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
diff --git a/apps/files_external/lib/Lib/IIdentifier.php b/apps/files_external/lib/Lib/IIdentifier.php
index df77d02b542..0677409a3cf 100644
--- a/apps/files_external/lib/Lib/IIdentifier.php
+++ b/apps/files_external/lib/Lib/IIdentifier.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
diff --git a/apps/files_external/lib/Lib/IdentifierTrait.php b/apps/files_external/lib/Lib/IdentifierTrait.php
index ff7bb8a465e..f5ffde32307 100644
--- a/apps/files_external/lib/Lib/IdentifierTrait.php
+++ b/apps/files_external/lib/Lib/IdentifierTrait.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
diff --git a/apps/files_external/lib/Lib/InsufficientDataForMeaningfulAnswerException.php b/apps/files_external/lib/Lib/InsufficientDataForMeaningfulAnswerException.php
index b2400f4be28..1e872b35072 100644
--- a/apps/files_external/lib/Lib/InsufficientDataForMeaningfulAnswerException.php
+++ b/apps/files_external/lib/Lib/InsufficientDataForMeaningfulAnswerException.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
diff --git a/apps/files_external/lib/Lib/LegacyDependencyCheckPolyfill.php b/apps/files_external/lib/Lib/LegacyDependencyCheckPolyfill.php
index 313d4ae8cb2..f6311fae83e 100644
--- a/apps/files_external/lib/Lib/LegacyDependencyCheckPolyfill.php
+++ b/apps/files_external/lib/Lib/LegacyDependencyCheckPolyfill.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
diff --git a/apps/files_external/lib/Lib/MissingDependency.php b/apps/files_external/lib/Lib/MissingDependency.php
index 5c2c6880f23..c2da7fcadbf 100644
--- a/apps/files_external/lib/Lib/MissingDependency.php
+++ b/apps/files_external/lib/Lib/MissingDependency.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
@@ -12,13 +13,14 @@ namespace OCA\Files_External\Lib;
class MissingDependency {
/** @var string|null Custom message */
- private $message = null;
+ private ?string $message = null;
+ private bool $optional = false;
/**
* @param string $dependency
*/
public function __construct(
- private $dependency,
+ private readonly string $dependency,
) {
}
@@ -38,4 +40,12 @@ class MissingDependency {
$this->message = $message;
return $this;
}
+
+ public function isOptional(): bool {
+ return $this->optional;
+ }
+
+ public function setOptional(bool $optional): void {
+ $this->optional = $optional;
+ }
}
diff --git a/apps/files_external/lib/Lib/Notify/SMBNotifyHandler.php b/apps/files_external/lib/Lib/Notify/SMBNotifyHandler.php
index deaf005e2c6..2812df6ad6a 100644
--- a/apps/files_external/lib/Lib/Notify/SMBNotifyHandler.php
+++ b/apps/files_external/lib/Lib/Notify/SMBNotifyHandler.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
diff --git a/apps/files_external/lib/Lib/PersonalMount.php b/apps/files_external/lib/Lib/PersonalMount.php
index 01daddd7e2a..d9dbddd1449 100644
--- a/apps/files_external/lib/Lib/PersonalMount.php
+++ b/apps/files_external/lib/Lib/PersonalMount.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
diff --git a/apps/files_external/lib/Lib/PriorityTrait.php b/apps/files_external/lib/Lib/PriorityTrait.php
index fef308a56dd..fad2c07e58c 100644
--- a/apps/files_external/lib/Lib/PriorityTrait.php
+++ b/apps/files_external/lib/Lib/PriorityTrait.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
diff --git a/apps/files_external/lib/Lib/SessionStorageWrapper.php b/apps/files_external/lib/Lib/SessionStorageWrapper.php
index 06bece3bf7c..8754041b2fa 100644
--- a/apps/files_external/lib/Lib/SessionStorageWrapper.php
+++ b/apps/files_external/lib/Lib/SessionStorageWrapper.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
diff --git a/apps/files_external/lib/Lib/Storage/AmazonS3.php b/apps/files_external/lib/Lib/Storage/AmazonS3.php
index 47967a3908d..5dc9e114532 100644
--- a/apps/files_external/lib/Lib/Storage/AmazonS3.php
+++ b/apps/files_external/lib/Lib/Storage/AmazonS3.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
diff --git a/apps/files_external/lib/Lib/Storage/FTP.php b/apps/files_external/lib/Lib/Storage/FTP.php
index e23fc791297..944964de7a6 100644
--- a/apps/files_external/lib/Lib/Storage/FTP.php
+++ b/apps/files_external/lib/Lib/Storage/FTP.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-only
diff --git a/apps/files_external/lib/Lib/Storage/OwnCloud.php b/apps/files_external/lib/Lib/Storage/OwnCloud.php
index 1bcf19b460e..12c305de750 100644
--- a/apps/files_external/lib/Lib/Storage/OwnCloud.php
+++ b/apps/files_external/lib/Lib/Storage/OwnCloud.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
diff --git a/apps/files_external/lib/Lib/Storage/SFTP.php b/apps/files_external/lib/Lib/Storage/SFTP.php
index 2619e678565..a2f5bafcca1 100644
--- a/apps/files_external/lib/Lib/Storage/SFTP.php
+++ b/apps/files_external/lib/Lib/Storage/SFTP.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
diff --git a/apps/files_external/lib/Lib/Storage/SMB.php b/apps/files_external/lib/Lib/Storage/SMB.php
index fc1f9b9ecd1..0899d2ac093 100644
--- a/apps/files_external/lib/Lib/Storage/SMB.php
+++ b/apps/files_external/lib/Lib/Storage/SMB.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
@@ -198,7 +199,7 @@ class SMB extends Common implements INotifyStorage {
try {
$acls = $file->getAcls();
} catch (Exception $e) {
- $this->logger->error('Error while getting file acls', ['exception' => $e]);
+ $this->logger->warning('Error while getting file acls', ['exception' => $e]);
return null;
}
foreach ($acls as $user => $acl) {
@@ -426,6 +427,7 @@ class SMB extends Common implements INotifyStorage {
case 'r':
case 'rb':
if (!$this->file_exists($path)) {
+ $this->logger->warning('Failed to open ' . $path . ' on ' . $this->getId() . ', file doesn\'t exist.');
return false;
}
return $this->share->read($fullPath);
@@ -453,11 +455,13 @@ class SMB extends Common implements INotifyStorage {
}
if ($this->file_exists($path)) {
if (!$this->isUpdatable($path)) {
+ $this->logger->warning('Failed to open ' . $path . ' on ' . $this->getId() . ', file not updatable.');
return false;
}
$tmpFile = $this->getCachedFile($path);
} else {
if (!$this->isCreatable(dirname($path))) {
+ $this->logger->warning('Failed to open ' . $path . ' on ' . $this->getId() . ', parent directory not writable.');
return false;
}
$tmpFile = \OCP\Server::get(ITempManager::class)->getTemporaryFile($ext);
@@ -472,13 +476,16 @@ class SMB extends Common implements INotifyStorage {
}
return false;
} catch (NotFoundException $e) {
+ $this->logger->warning('Failed to open ' . $path . ' on ' . $this->getId() . ', not found.', ['exception' => $e]);
return false;
} catch (ForbiddenException $e) {
+ $this->logger->warning('Failed to open ' . $path . ' on ' . $this->getId() . ', forbidden.', ['exception' => $e]);
return false;
} catch (OutOfSpaceException $e) {
+ $this->logger->warning('Failed to open ' . $path . ' on ' . $this->getId() . ', out of space.', ['exception' => $e]);
throw new EntityTooLargeException('not enough available space to create file', 0, $e);
} catch (ConnectException $e) {
- $this->logger->error('Error while opening file', ['exception' => $e]);
+ $this->logger->error('Error while opening file ' . $path . ' on ' . $this->getId(), ['exception' => $e]);
throw new StorageNotAvailableException($e->getMessage(), (int)$e->getCode(), $e);
}
}
diff --git a/apps/files_external/lib/Lib/Storage/StreamWrapper.php b/apps/files_external/lib/Lib/Storage/StreamWrapper.php
index 0490acc98e1..1272b9d4d8a 100644
--- a/apps/files_external/lib/Lib/Storage/StreamWrapper.php
+++ b/apps/files_external/lib/Lib/Storage/StreamWrapper.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2020-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
diff --git a/apps/files_external/lib/Lib/Storage/Swift.php b/apps/files_external/lib/Lib/Storage/Swift.php
index a71331766d4..e80570f14ba 100644
--- a/apps/files_external/lib/Lib/Storage/Swift.php
+++ b/apps/files_external/lib/Lib/Storage/Swift.php
@@ -288,7 +288,6 @@ class Swift extends Common {
public function stat(string $path): array|false {
$path = $this->normalizePath($path);
-
if ($path === '.') {
$path = '';
} elseif ($this->is_dir($path)) {
@@ -308,22 +307,23 @@ class Swift extends Common {
return false;
}
- $dateTime = $object->lastModified ? \DateTime::createFromFormat(\DateTime::RFC1123, $object->lastModified) : false;
- $mtime = $dateTime ? $dateTime->getTimestamp() : null;
- $objectMetadata = $object->getMetadata();
- if (isset($objectMetadata['timestamp'])) {
- $mtime = $objectMetadata['timestamp'];
+ $mtime = null;
+ if (!empty($object->lastModified)) {
+ $dateTime = \DateTime::createFromFormat(\DateTime::RFC1123, $object->lastModified);
+ if ($dateTime !== false) {
+ $mtime = $dateTime->getTimestamp();
+ }
}
- if (!empty($mtime)) {
- $mtime = floor($mtime);
+ if (is_numeric($object->getMetadata()['timestamp'] ?? null)) {
+ $mtime = (float)$object->getMetadata()['timestamp'];
}
- $stat = [];
- $stat['size'] = (int)$object->contentLength;
- $stat['mtime'] = $mtime;
- $stat['atime'] = time();
- return $stat;
+ return [
+ 'size' => (int)$object->contentLength,
+ 'mtime' => isset($mtime) ? (int)floor($mtime) : null,
+ 'atime' => time(),
+ ];
}
public function filetype(string $path) {
diff --git a/apps/files_external/lib/Lib/StorageConfig.php b/apps/files_external/lib/Lib/StorageConfig.php
index a9a03528b8f..2cb82d3790a 100644
--- a/apps/files_external/lib/Lib/StorageConfig.php
+++ b/apps/files_external/lib/Lib/StorageConfig.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
diff --git a/apps/files_external/lib/Lib/StorageModifierTrait.php b/apps/files_external/lib/Lib/StorageModifierTrait.php
index 4b9264f4223..4062ff1635e 100644
--- a/apps/files_external/lib/Lib/StorageModifierTrait.php
+++ b/apps/files_external/lib/Lib/StorageModifierTrait.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
diff --git a/apps/files_external/lib/Lib/VisibilityTrait.php b/apps/files_external/lib/Lib/VisibilityTrait.php
index 63aa709b21c..62b26f3edb1 100644
--- a/apps/files_external/lib/Lib/VisibilityTrait.php
+++ b/apps/files_external/lib/Lib/VisibilityTrait.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
diff --git a/apps/files_external/lib/Listener/LoadAdditionalListener.php b/apps/files_external/lib/Listener/LoadAdditionalListener.php
index 66d06675291..6ba917759c3 100644
--- a/apps/files_external/lib/Listener/LoadAdditionalListener.php
+++ b/apps/files_external/lib/Listener/LoadAdditionalListener.php
@@ -10,10 +10,11 @@ namespace OCA\Files_External\Listener;
use OCA\Files\Event\LoadAdditionalScriptsEvent;
use OCA\Files_External\AppInfo\Application;
+use OCA\Files_External\ConfigLexicon;
use OCP\AppFramework\Services\IInitialState;
use OCP\EventDispatcher\Event;
use OCP\EventDispatcher\IEventListener;
-use OCP\IConfig;
+use OCP\IAppConfig;
use OCP\Util;
/**
@@ -22,7 +23,7 @@ use OCP\Util;
class LoadAdditionalListener implements IEventListener {
public function __construct(
- private IConfig $config,
+ private readonly IAppConfig $appConfig,
private IInitialState $initialState,
) {
}
@@ -32,7 +33,7 @@ class LoadAdditionalListener implements IEventListener {
return;
}
- $allowUserMounting = $this->config->getAppValue('files_external', 'allow_user_mounting', 'no') === 'yes';
+ $allowUserMounting = $this->appConfig->getValueBool('files_external', ConfigLexicon::ALLOW_USER_MOUNTING);
$this->initialState->provideInitialState('allowUserMounting', $allowUserMounting);
Util::addInitScript(Application::APP_ID, 'init');
diff --git a/apps/files_external/lib/Migration/DummyUserSession.php b/apps/files_external/lib/Migration/DummyUserSession.php
index 3d9412bd755..1ebf0e1ec4f 100644
--- a/apps/files_external/lib/Migration/DummyUserSession.php
+++ b/apps/files_external/lib/Migration/DummyUserSession.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
diff --git a/apps/files_external/lib/MountConfig.php b/apps/files_external/lib/MountConfig.php
index 2289a5008e5..a7d9e6f2603 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.
diff --git a/apps/files_external/lib/NotFoundException.php b/apps/files_external/lib/NotFoundException.php
index 78fbda2a4b8..411a2212513 100644
--- a/apps/files_external/lib/NotFoundException.php
+++ b/apps/files_external/lib/NotFoundException.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
diff --git a/apps/files_external/lib/Service/BackendService.php b/apps/files_external/lib/Service/BackendService.php
index b452b27e175..3a688ee66e6 100644
--- a/apps/files_external/lib/Service/BackendService.php
+++ b/apps/files_external/lib/Service/BackendService.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
@@ -7,14 +8,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 +58,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 +189,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;
});
}
@@ -263,8 +259,8 @@ class BackendService {
* @return bool
*/
protected function isAllowedUserBackend(Backend $backend) {
- if ($this->userMountingAllowed &&
- array_intersect($backend->getIdentifierAliases(), $this->userMountingBackends)
+ if ($this->userMountingAllowed
+ && array_intersect($backend->getIdentifierAliases(), $this->userMountingBackends)
) {
return true;
}
diff --git a/apps/files_external/lib/Service/DBConfigService.php b/apps/files_external/lib/Service/DBConfigService.php
index 3820f6b0d96..41ec4512d70 100644
--- a/apps/files_external/lib/Service/DBConfigService.php
+++ b/apps/files_external/lib/Service/DBConfigService.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
diff --git a/apps/files_external/lib/Service/GlobalStoragesService.php b/apps/files_external/lib/Service/GlobalStoragesService.php
index 92961d73228..5b1a9f41e48 100644
--- a/apps/files_external/lib/Service/GlobalStoragesService.php
+++ b/apps/files_external/lib/Service/GlobalStoragesService.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
diff --git a/apps/files_external/lib/Service/ImportLegacyStoragesService.php b/apps/files_external/lib/Service/ImportLegacyStoragesService.php
index fe5e71c1a47..7d9840e9f5e 100644
--- a/apps/files_external/lib/Service/ImportLegacyStoragesService.php
+++ b/apps/files_external/lib/Service/ImportLegacyStoragesService.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
* SPDX-License-Identifier: AGPL-3.0-only
diff --git a/apps/files_external/lib/Service/LegacyStoragesService.php b/apps/files_external/lib/Service/LegacyStoragesService.php
index 5be1a084b66..9f199a89b3f 100644
--- a/apps/files_external/lib/Service/LegacyStoragesService.php
+++ b/apps/files_external/lib/Service/LegacyStoragesService.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
diff --git a/apps/files_external/lib/Service/StoragesService.php b/apps/files_external/lib/Service/StoragesService.php
index 73642d85f88..a12a8fc245a 100644
--- a/apps/files_external/lib/Service/StoragesService.php
+++ b/apps/files_external/lib/Service/StoragesService.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
diff --git a/apps/files_external/lib/Service/UserGlobalStoragesService.php b/apps/files_external/lib/Service/UserGlobalStoragesService.php
index 01bc91ef3ff..aaa59c85d62 100644
--- a/apps/files_external/lib/Service/UserGlobalStoragesService.php
+++ b/apps/files_external/lib/Service/UserGlobalStoragesService.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
diff --git a/apps/files_external/lib/Service/UserStoragesService.php b/apps/files_external/lib/Service/UserStoragesService.php
index defa97451cd..9d4192734b6 100644
--- a/apps/files_external/lib/Service/UserStoragesService.php
+++ b/apps/files_external/lib/Service/UserStoragesService.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
diff --git a/apps/files_external/lib/Service/UserTrait.php b/apps/files_external/lib/Service/UserTrait.php
index 25713894e1f..679066283a5 100644
--- a/apps/files_external/lib/Service/UserTrait.php
+++ b/apps/files_external/lib/Service/UserTrait.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
diff --git a/apps/files_external/lib/Settings/Admin.php b/apps/files_external/lib/Settings/Admin.php
index 8476e87f3c6..9af0f3c61c1 100644
--- a/apps/files_external/lib/Settings/Admin.php
+++ b/apps/files_external/lib/Settings/Admin.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
diff --git a/apps/files_external/lib/Settings/Personal.php b/apps/files_external/lib/Settings/Personal.php
index f691c14270e..8478badb842 100644
--- a/apps/files_external/lib/Settings/Personal.php
+++ b/apps/files_external/lib/Settings/Personal.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
diff --git a/apps/files_external/lib/Settings/PersonalSection.php b/apps/files_external/lib/Settings/PersonalSection.php
index df494edce27..c6eb1c6b889 100644
--- a/apps/files_external/lib/Settings/PersonalSection.php
+++ b/apps/files_external/lib/Settings/PersonalSection.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
diff --git a/apps/files_external/lib/Settings/Section.php b/apps/files_external/lib/Settings/Section.php
index 8bc0814bb67..cf3b73472d7 100644
--- a/apps/files_external/lib/Settings/Section.php
+++ b/apps/files_external/lib/Settings/Section.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later