feat: implement SQLite backup & data integrity plan (Phases 2-4)

This commit is contained in:
Pontoporeia
2026-05-11 01:08:46 +02:00
parent c0163ca4d5
commit 926659087f
18 changed files with 683 additions and 151 deletions

View File

@@ -398,7 +398,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_FILES['csv_file'])) {
$langName = strtolower($langName);
if ($langName === '') continue;
// Lookup case-insensitively; insert if missing (stored lowercase).
$s = $importPdo->prepare("SELECT id FROM languages WHERE LOWER(name) = LOWER(?)");
$s = $importPdo->prepare("SELECT id FROM languages WHERE LOWER(name) = LOWER(?) AND deleted_at IS NULL");
$s->execute([$langName]);
$r = $s->fetch();
$langId = $r ? (int)$r['id'] : null;
@@ -470,6 +470,9 @@ try {
$years = $db->getAllYears();
$orientations = $db->getAllOrientations();
$apPrograms = $db->getAllAPPrograms();
$trashCount = $db->countTrashedTheses();
$tab = $_GET['tab'] ?? 'list';
$trashedTheses = ($tab === 'trash') ? $db->getTrashedTheses() : [];
} catch (Exception $e) {
error_log("Error loading theses list: " . $e->getMessage());
die("Erreur lors du chargement de la liste.");
@@ -478,11 +481,19 @@ try {
$isHtmx = ($_SERVER['HTTP_HX_REQUEST'] ?? '') === 'true';
$isAdmin = true; $bodyClass = 'admin-body';
if ($isHtmx) {
include APP_ROOT . '/templates/admin/index-table.php';
if ($tab === 'trash') {
include APP_ROOT . '/templates/admin/index-trash.php';
} else {
include APP_ROOT . '/templates/admin/index-table.php';
}
} else {
require_once APP_ROOT . '/templates/head.php';
include APP_ROOT . '/templates/header.php';
include APP_ROOT . '/templates/admin/index.php';
if ($tab === 'trash') {
include APP_ROOT . '/templates/admin/index-trash.php';
} else {
include APP_ROOT . '/templates/admin/index.php';
}
require_once APP_ROOT . '/templates/admin/footer.php';
}