aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_external/lib/Command/Dependencies.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_external/lib/Command/Dependencies.php')
-rw-r--r--apps/files_external/lib/Command/Dependencies.php57
1 files changed, 57 insertions, 0 deletions
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;
+ }
+}