diff options
| author | polo <ordipolo@gmx.fr> | 2026-06-03 23:15:17 +0200 |
|---|---|---|
| committer | polo <ordipolo@gmx.fr> | 2026-06-03 23:15:17 +0200 |
| commit | f37d3f8979b34dbb03d7a39ccbb3889763bea61d (patch) | |
| tree | 81e8301b2db8eddb1a6f27f10fb8f49f97e2eb66 /src/controller/MaintenanceController.php | |
| parent | 34c4d0d0c37c7f640a1a6373bba30ebe1129d6c4 (diff) | |
| download | cms-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.php | 16 |
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...) |
