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:
authorhashworks <mail@hashworks.net>2021-12-05 19:27:13 +0300
committerhashworks <mail@hashworks.net>2021-12-05 19:31:12 +0300
commit8a357bed1c76bef41057bd5b8e98650184b8cd00 (patch)
tree7a55f363a94c50b2fa747058fbc46fbac0c0dbd2
parent3cde4b8a5ad86c9a7cc524e6c4eed22f02bf8e5b (diff)
Make GlobalStoragesService optional
GlobalStoragesService is only available when the "External storage support" app is enabled. Signed-off-by: hashworks <mail@hashworks.net>
-rw-r--r--lib/Command/Generate.php17
1 files changed, 10 insertions, 7 deletions
diff --git a/lib/Command/Generate.php b/lib/Command/Generate.php
index bb54588..7e7663c 100644
--- a/lib/Command/Generate.php
+++ b/lib/Command/Generate.php
@@ -69,20 +69,20 @@ class Generate extends Command {
/** @var IManager */
protected $encryptionManager;
- public function __construct(GlobalStoragesService $globalService,
- IRootFolder $rootFolder,
+ public function __construct(IRootFolder $rootFolder,
IUserManager $userManager,
IPreview $previewGenerator,
IConfig $config,
- IManager $encryptionManager) {
+ IManager $encryptionManager,
+ GlobalStoragesService $globalService = null) {
parent::__construct();
- $this->globalService = $globalService;
$this->userManager = $userManager;
$this->rootFolder = $rootFolder;
$this->previewGenerator = $previewGenerator;
$this->config = $config;
$this->encryptionManager = $encryptionManager;
+ $this->globalService = $globalService;
}
protected function configure() {
@@ -140,6 +140,9 @@ class Generate extends Command {
}
private function getNoPreviewMountPaths(IUser $user) {
+ if ($this->globalService === null) {
+ return [];
+ }
$mountPaths = [];
$userId = $user->getUID();
$mounts = $this->globalService->getStorageForAllUsers();
@@ -147,8 +150,8 @@ class Generate extends Command {
if (in_array($userId, $mount->getApplicableUsers()) &&
$mount->getMountOptions()['previews'] === false
) {
- $rootFolder = $this->rootFolder->getUserFolder($userId)->getPath();
- array_push($mountPaths, $rootFolder.$mount->getMountPoint());
+ $userFolder = $this->rootFolder->getUserFolder($userId)->getPath();
+ array_push($mountPaths, $userFolder.$mount->getMountPoint());
}
}
return $mountPaths;
@@ -195,7 +198,7 @@ class Generate extends Command {
foreach ($nodes as $node) {
if ($node instanceof Folder) {
- $this->parseFolder($node);
+ $this->parseFolder($node, $noPreviewMountPaths);
} elseif ($node instanceof File) {
$this->parseFile($node);
}