Skip to content

Commit b760aa9

Browse files
authored
Merge pull request #24368 from nextcloud/backport/24363/stable19
[stable19] Catch storage not available in versions expire command
2 parents 35cc99f + 2e511e3 commit b760aa9

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

apps/files_versions/lib/Command/Expire.php

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
use OC\Command\FileAccess;
2929
use OCA\Files_Versions\Storage;
3030
use OCP\Command\ICommand;
31+
use OCP\Files\StorageNotAvailableException;
32+
use OCP\ILogger;
3133

3234
class Expire implements ICommand {
3335
use FileAccess;
@@ -59,6 +61,20 @@ public function handle() {
5961
return;
6062
}
6163

62-
Storage::expire($this->fileName, $this->user);
64+
try {
65+
Storage::expire($this->fileName, $this->user);
66+
} catch (StorageNotAvailableException $e) {
67+
// In case of external storage and session credentials, the expiration
68+
// fails because the command does not have those credentials
69+
70+
/** @var ILogger $logger */
71+
$logger = \OC::$server->query(ILogger::class);
72+
73+
$logger->logException($e, [
74+
'level' => ILogger::WARN,
75+
'uid' => $this->user,
76+
'fileName' => $this->fileName,
77+
]);
78+
}
6379
}
6480
}

0 commit comments

Comments
 (0)