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;
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,
+ ]);
+ }
}
}