File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -46,8 +46,8 @@ public function getBackups()
46
46
$ filesData = [];
47
47
48
48
foreach ($ files as $ index => $ file ) {
49
- if (! is_array ( $ file) ) {
50
- $ name = str_replace (config ( ' backupmanager.backups.backup_path ' ). " / " ,"" ,$ file ->path ());
49
+ if ($ file instanceof \ League \ Flysystem \FileAttributes ) {
50
+ $ name = str_replace ($ this -> backupPath ,"" ,$ file ->path ());
51
51
$ array = explode ('_ ' , $ name );
52
52
$ filesData [] = [
53
53
'name ' => $ name ,
@@ -378,12 +378,17 @@ protected function deleteOldBackups()
378
378
if ($ file ['type ' ] !== 'file ' ) {
379
379
continue ;
380
380
}
381
+ if (empty ($ file ['basename ' ])) {
382
+ $ filename = $ file ->path ();
383
+ }else {
384
+ $ filename = $ this ->backupPath . $ file ['basename ' ];
385
+ }
381
386
382
387
if ($ now - $ this ->getFileTimeStamp ($ file ) >= 60 * 60 * 24 * $ daysOldToDelete ) {
383
- if (Storage::disk ($ this ->disk )->exists ($ this -> backupPath . $ file [ ' basename ' ] )) {
384
- Storage::disk ($ this ->disk )->delete ($ this -> backupPath . $ file [ ' basename ' ] );
385
-
386
- Log::info ('Deleted old backup file: ' . $ file [ ' basename ' ] );
388
+ if (Storage::disk ($ this ->disk )->exists ($ filename )) {
389
+ Storage::disk ($ this ->disk )->delete ($ filename );
390
+ $ name = str_replace ( $ this -> backupPath , "" , $ filename );
391
+ Log::info ('Deleted old backup file: ' . $ name );
387
392
}
388
393
}
389
394
}
You can’t perform that action at this time.
0 commit comments