v1.3.1 - siehe Release Notes

This commit is contained in:
Borgal
2025-11-21 11:45:10 +01:00
parent 654157f174
commit 968bbdec3b
10 changed files with 209 additions and 180 deletions

View File

@@ -25,8 +25,31 @@ if ($handle = opendir($backup_dir)) {
}
}
closedir($handle);
// Sortieren: neueste zuerst
usort($files, fn($a, $b) => $b['mtime'] <=> $a['mtime']);
// 🔸 Sortieren nach Datum im Dateinamen: DoMiLi_Backup_YYYY-MM[_x].pdf
usort($files, function ($a, $b) {
// Extrahiere YYYY-MM aus dem Dateinamen (ohne .pdf)
$nameA = pathinfo($a['name'], PATHINFO_FILENAME);
$nameB = pathinfo($b['name'], PATHINFO_FILENAME);
// Regex: Suche nach 4 Ziffern, Bindestrich, 2 Ziffern
$dateA = null;
$dateB = null;
if (preg_match('/(\d{4}-\d{2})/', $nameA, $matchesA)) {
$dateA = $matchesA[1];
}
if (preg_match('/(\d{4}-\d{2})/', $nameB, $matchesB)) {
$dateB = $matchesB[1];
}
// Wenn kein Datum gefunden: ans Ende schieben
if ($dateA === null && $dateB === null) return 0;
if ($dateA === null) return 1; // A hinter B
if ($dateB === null) return -1; // B hinter A
// Absteigend sortieren: neuestes zuerst → "2025-07" > "2025-02"
return $dateB <=> $dateA;
});
}
require_once 'inc/header.php';