@@ -46,7 +46,7 @@ public function getBackups()
46
46
$ filesData = [];
47
47
foreach ($ files as $ index => $ file ) {
48
48
if ($ file instanceof \League \Flysystem \FileAttributes) {
49
- $ name = str_replace ( $ this -> backupPath , '' , $ file ->path ()) ;
49
+ $ name = $ file -> extraMetadata ()[ ' filename ' ]. " . " . $ file ->extraMetadata ()[ ' extension ' ] ;
50
50
$ array = explode ('_ ' , $ name );
51
51
$ filesData [] = [
52
52
'name ' => $ name ,
@@ -179,7 +179,7 @@ function ($str) {
179
179
$ storageLocal ->delete ($ this ->fBackupName );
180
180
}
181
181
if ($ bypass ===true ) {
182
- $ this ->deleteOldBackups ();
182
+ $ this ->deleteOldBackups (" f " );
183
183
}
184
184
}
185
185
}
@@ -248,7 +248,7 @@ public function backupDatabase($bypass=false)
248
248
}
249
249
250
250
if ($ bypass ===true ) {
251
- $ this ->deleteOldBackups ();
251
+ $ this ->deleteOldBackups (" d " );
252
252
}
253
253
}
254
254
}
@@ -372,7 +372,7 @@ protected function getRestoreStatus($isFiles)
372
372
*
373
373
* @return void
374
374
*/
375
- protected function deleteOldBackups ()
375
+ protected function deleteOldBackups ($ del_specific = "" )
376
376
{
377
377
$ daysOldToDelete = (int )config ('backupmanager.backups.delete_old_backup_days ' );
378
378
$ now = time ();
@@ -387,7 +387,15 @@ protected function deleteOldBackups()
387
387
}else {
388
388
$ filename = $ this ->backupPath . $ file ['basename ' ];
389
389
}
390
-
390
+ if ($ del_specific !=="" ) {
391
+ //skip delete if del_specific has value for specific deletes only
392
+ if (!empty ($ file ['basename ' ][0 ]) && $ file ['basename ' ][0 ] !== $ del_specific ) {
393
+ continue ;
394
+ }
395
+ if (!empty ($ file ->extraMetadata ()['filename ' ][0 ]) && $ file ->extraMetadata ()['filename ' ][0 ].". " .$ file ->extraMetadata ()['extension ' ][0 ] !== $ del_specific ) {
396
+ continue ;
397
+ }
398
+ }
391
399
if ($ now - $ this ->getFileTimeStamp ($ file ) >= 60 * 60 * 24 * $ daysOldToDelete ) {
392
400
if (Storage::disk ($ this ->disk )->exists ($ filename )) {
393
401
Storage::disk ($ this ->disk )->delete ($ filename );
0 commit comments