diff options
author | Christoph Wurst <ChristophWurst@users.noreply.github.com> | 2020-11-25 11:37:33 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-25 11:37:33 +0100 |
commit | 82864ef8a7adab5195c1e49081c37601ee81ca8f (patch) | |
tree | 398371112b6d3bd649921c5499d311e53fa916f3 | |
parent | 01790537f623ad193308172144216375608b3e0d (diff) | |
parent | 12d1c27b7f274c32902ae59483d873861aeed500 (diff) | |
download | nextcloud-server-82864ef8a7adab5195c1e49081c37601ee81ca8f.tar.gz nextcloud-server-82864ef8a7adab5195c1e49081c37601ee81ca8f.zip |
Merge pull request #24363 from nextcloud/fix/versions-expire-storage-not-available
Catch storage not available in versions expire command
-rw-r--r-- | apps/files_versions/lib/Command/Expire.php | 18 |
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 1075314c1c4..bf3400b5018 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->get(ILogger::class); + + $logger->logException($e, [ + 'level' => ILogger::WARN, + 'uid' => $this->user, + 'fileName' => $this->fileName, + ]); + } } } |