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

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2020-11-25 18:17:45 +0300
committerGitHub <noreply@github.com>2020-11-25 18:17:45 +0300
commit993b7b5e96cc50a1914d10ddb9f580be662a3843 (patch)
tree158367b696712f7e17a7f1cbc45117f157482948
parent71b176d5e0c507c8af00a28a12125439b3e3c7fc (diff)
parent19678d182fac9c01569324212e9d643a4013cfc5 (diff)
Merge pull request #24369 from nextcloud/backport/24363/stable18
[stable18] Catch storage not available in versions expire command
-rw-r--r--apps/files_versions/lib/Command/Expire.php18
1 files changed, 17 insertions, 1 deletions
diff --git a/apps/files_versions/lib/Command/Expire.php b/apps/files_versions/lib/Command/Expire.php
index 55f88aba688..723cc860fd0 100644
--- a/apps/files_versions/lib/Command/Expire.php
+++ b/apps/files_versions/lib/Command/Expire.php
@@ -28,6 +28,8 @@ namespace OCA\Files_Versions\Command;
use OC\Command\FileAccess;
use OCA\Files_Versions\Storage;
use OCP\Command\ICommand;
+use OCP\Files\StorageNotAvailableException;
+use OCP\ILogger;
class Expire implements ICommand {
use FileAccess;
@@ -59,6 +61,20 @@ class Expire implements ICommand {
return;
}
- Storage::expire($this->fileName, $this->user);
+ try {
+ Storage::expire($this->fileName, $this->user);
+ } catch (StorageNotAvailableException $e) {
+ // In case of external storage and session credentials, the expiration
+ // fails because the command does not have those credentials
+
+ /** @var ILogger $logger */
+ $logger = \OC::$server->query(ILogger::class);
+
+ $logger->logException($e, [
+ 'level' => ILogger::WARN,
+ 'uid' => $this->user,
+ 'fileName' => $this->fileName,
+ ]);
+ }
}
}