File tree Expand file tree Collapse file tree
apps/files_versions/lib/Command Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2828use OC \Command \FileAccess ;
2929use OCA \Files_Versions \Storage ;
3030use OCP \Command \ICommand ;
31+ use OCP \Files \StorageNotAvailableException ;
32+ use OCP \ILogger ;
3133
3234class 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}
You can’t perform that action at this time.
0 commit comments