@@ -308,7 +308,7 @@ function GetAvailableJSONBackups(){
308
308
$ dir_jsonbackups = GetDirSetting ('JsonBackups ' );
309
309
310
310
//Grabs only the array keys which contain the JSON filenames
311
- $ json_config_backup_filenames = (read_directory_files ($ dir_jsonbackups , true , true , 'asc ' ));
311
+ $ json_config_backup_filenames = (read_directory_files ($ dir_jsonbackups , false , true , 'asc ' ));
312
312
//Process the backup files to extra some info about them
313
313
$ json_config_backup_filenames = process_jsonbackup_file_data_helper ($ json_config_backup_filenames , $ dir_jsonbackups );
314
314
@@ -317,11 +317,11 @@ function GetAvailableJSONBackups(){
317
317
$ dir_jsonbackupsalternate = GetDirSetting ('JsonBackupsAlternate ' );
318
318
319
319
//$settings['jsonConfigBackupUSBLocation'] is the selected alternative drive to stop backups to
320
- $ json_config_backup_filenames_on_alternative = DriveMountHelper ($ settings ['jsonConfigBackupUSBLocation ' ], 'read_directory_files ' , array ($ dir_jsonbackupsalternate , true , true , 'asc ' ));
320
+ $ json_config_backup_filenames_on_alternative = DriveMountHelper ($ settings ['jsonConfigBackupUSBLocation ' ], 'read_directory_files ' , array ($ dir_jsonbackupsalternate , false , true , 'asc ' ));
321
321
//Process the backup files to extra some info about them
322
322
$ json_config_backup_filenames_on_alternative = process_jsonbackup_file_data_helper ($ json_config_backup_filenames_on_alternative , $ dir_jsonbackupsalternate );
323
323
}
324
- //Merge the results together, if t he same backup name exists in the alternative backup location it will overwrite the record from the local cnfig directory
324
+ //Merge the results together, if the same backup name exists in the alternative backup location it will overwrite the record from the local cnfig directory
325
325
$ json_config_backup_filenames_clean = array_merge ($ json_config_backup_filenames , $ json_config_backup_filenames_on_alternative );
326
326
327
327
//Once merged - do another sort on the entries but sort on the backup_time_unix value
@@ -356,7 +356,8 @@ function process_jsonbackup_file_data_helper($json_config_backup_Data, $source_d
356
356
//cleanup the filename so it can be used as as a ID
357
357
$ backup_filename_clean = trim (str_replace ('.json ' , '' , $ backup_filename ));
358
358
359
- $ decoded_backup_data = json_decode ($ backup_data [0 ], true );
359
+ //Read the backup file so we can extract some metadata
360
+ $ decoded_backup_data = json_decode (file_get_contents ($ backup_filepath . '/ ' . $ backup_filename ), true );
360
361
if (array_key_exists ('backup_comment ' , $ decoded_backup_data )) {
361
362
$ backup_data_comment = $ decoded_backup_data ['backup_comment ' ];
362
363
}
@@ -380,6 +381,8 @@ function process_jsonbackup_file_data_helper($json_config_backup_Data, $source_d
380
381
'backup_time ' => $ backup_date_time ,
381
382
'backup_time_unix ' => $ backup_date_time_unix
382
383
);
384
+
385
+ unset($ decoded_backup_data );
383
386
}
384
387
385
388
return $ json_config_backup_filenames_clean ;
0 commit comments