Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/previewgenerator.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Steinmetz <richard@steinmetz.cloud>2021-12-15 12:52:43 +0300
committerGitHub <noreply@github.com>2021-12-15 12:52:43 +0300
commit90d4b494290def788a1dfd7a6d98d8fe130eaf8f (patch)
treecd17e3a6a215c36d7dbc247d670264b3abbfbdb7
parent6e9aee3b5030dd5eee21124b4c954930fce3fc14 (diff)
parentf8e2628ad2c5b964d93c29cd7a8912af680c5b40 (diff)
Merge pull request #273 from nextcloud/fix/269/autowiring-nc-20
Query GlobalStoragesService from the container
-rw-r--r--lib/Command/Generate.php11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/Command/Generate.php b/lib/Command/Generate.php
index c461fbc..738d24e 100644
--- a/lib/Command/Generate.php
+++ b/lib/Command/Generate.php
@@ -37,6 +37,8 @@ use OCP\IPreview;
use OCP\IUser;
use OCP\IUserManager;
use OCA\Files_External\Service\GlobalStoragesService;
+use Psr\Container\ContainerExceptionInterface;
+use Psr\Container\ContainerInterface;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
@@ -74,7 +76,7 @@ class Generate extends Command {
IPreview $previewGenerator,
IConfig $config,
IManager $encryptionManager,
- ?GlobalStoragesService $globalService = null) {
+ ContainerInterface $container) {
parent::__construct();
$this->userManager = $userManager;
@@ -82,7 +84,12 @@ class Generate extends Command {
$this->previewGenerator = $previewGenerator;
$this->config = $config;
$this->encryptionManager = $encryptionManager;
- $this->globalService = $globalService;
+
+ try {
+ $this->globalService = $container->get(GlobalStoragesService::class);
+ } catch (ContainerExceptionInterface $e) {
+ $this->globalService = null;
+ }
}
protected function configure() {