Switch backup files array order to show latest first [ch15486]'

This commit is contained in:
snipe 2020-11-30 14:46:10 -08:00
parent 4882b01787
commit e83bc03d97

View file

@ -1015,7 +1015,7 @@ class SettingsController extends Controller
$path = 'app/backups';
$backup_files = Storage::files($path);
$files = [];
$files_raw = [];
if (count($backup_files) > 0) {
for ($f = 0; $f < count($backup_files); ++$f) {
@ -1023,7 +1023,7 @@ class SettingsController extends Controller
// Skip dotfiles like .gitignore and .DS_STORE
if ((substr(basename($backup_files[$f]), 0, 1) != '.')) {
$files[] = [
$files_raw[] = [
'filename' => basename($backup_files[$f]),
'filesize' => Setting::fileSizeConvert(Storage::size($backup_files[$f])),
'modified' => Storage::lastModified($backup_files[$f]),
@ -1035,6 +1035,9 @@ class SettingsController extends Controller
}
}
// Reverse the array so it lists oldest first
$files = array_reverse($files_raw);
return view('settings/backups', compact('path', 'files'));
}