aboutsummaryrefslogtreecommitdiff
path: root/src/controller/MaintenanceController.php
diff options
context:
space:
mode:
authorpolo <ordipolo@gmx.fr>2026-06-03 23:15:17 +0200
committerpolo <ordipolo@gmx.fr>2026-06-03 23:15:17 +0200
commitf37d3f8979b34dbb03d7a39ccbb3889763bea61d (patch)
tree81e8301b2db8eddb1a6f27f10fb8f49f97e2eb66 /src/controller/MaintenanceController.php
parent34c4d0d0c37c7f640a1a6373bba30ebe1129d6c4 (diff)
downloadcms-f37d3f8979b34dbb03d7a39ccbb3889763bea61d.tar.gz
cms-f37d3f8979b34dbb03d7a39ccbb3889763bea61d.tar.bz2
cms-f37d3f8979b34dbb03d7a39ccbb3889763bea61d.zip
exclusion des htaccess des zip, erreur création backup quand dossier var/backups pas encore créé
Diffstat (limited to 'src/controller/MaintenanceController.php')
-rw-r--r--src/controller/MaintenanceController.php16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/controller/MaintenanceController.php b/src/controller/MaintenanceController.php
index eb1db04..47e51ac 100644
--- a/src/controller/MaintenanceController.php
+++ b/src/controller/MaintenanceController.php
@@ -49,10 +49,22 @@ class MaintenanceController
49 die; 49 die;
50 } 50 }
51 51
52 static public function getLastDump(): void 52 static public function getLastDump(EntityManager $entityManager): void
53 { 53 {
54 $backup_list = Backup::getBackupList();
55 $nb = count($backup_list);
56
57 if($nb <= 0){ // se produit à la première connexion en mode admin pour une raison algorithimque
58 Backup::mySQLdump($entityManager, 'auto');
59 $backup_list = Backup::getBackupList();
60 $nb = count($backup_list);
61 if($nb <= 0){ // improbable, les dossiers devraient déjà avoir été créés
62 throw new RuntimeException("Le serveur a rencontré une erreur: aucun backup n'est disponible et ce n'est pas normal.");
63 }
64 }
65
54 try{ 66 try{
55 $file_path = Backup::$backup_dir . '/' . Backup::getLastBackupName(); 67 $file_path = Backup::$backup_dir . '/' . $backup_list[$nb - 1];
56 header('Content-Type: application/octet-stream'); // signifie fichier quelconque, du binaire quoi! 68 header('Content-Type: application/octet-stream'); // signifie fichier quelconque, du binaire quoi!
57 header('Content-Disposition: attachment; filename="' . basename($file_path) . '"'); // pour provoquer un téléchargement et non pour afficher 69 header('Content-Disposition: attachment; filename="' . basename($file_path) . '"'); // pour provoquer un téléchargement et non pour afficher
58 header('Content-Length: ' . filesize($file_path)); // peut servir côté client (barre de progression...) 70 header('Content-Length: ' . filesize($file_path)); // peut servir côté client (barre de progression...)