diff options
| -rw-r--r-- | controller/backup.php | 14 | ||||
| -rw-r--r-- | index.php | 4 |
2 files changed, 9 insertions, 9 deletions
diff --git a/controller/backup.php b/controller/backup.php index 52f300f..6c3a654 100644 --- a/controller/backup.php +++ b/controller/backup.php | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | // controller/backup.php | 2 | // controller/backup.php |
| 3 | 3 | ||
| 4 | // note: faire que cette fonction soit exécutée automatiquement de temps en temps | 4 | // note: faire que cette fonction soit exécutée automatiquement de temps en temps |
| 5 | function pageSauvegarde($from) | 5 | function pageSauvegarde(): void |
| 6 | { | 6 | { |
| 7 | $title = 'extraction des données'; | 7 | $title = 'extraction des données'; |
| 8 | 8 | ||
| @@ -21,13 +21,13 @@ function pageSauvegarde($from) | |||
| 21 | require('view/backup.php'); | 21 | require('view/backup.php'); |
| 22 | } | 22 | } |
| 23 | 23 | ||
| 24 | function createZipMelainePHP() | 24 | function createZipMelainePHP(): void |
| 25 | { | 25 | { |
| 26 | $cheminDestination = 'data/'; | 26 | $cheminDestination = 'data/'; |
| 27 | $nomFichier = "melainePHP"; | 27 | $nomFichier = "melainePHP"; |
| 28 | // tous les dossiers sauf data et .git | 28 | // tous les dossiers sauf data et .git |
| 29 | $dossiersCibles = ['model', 'view', 'controller', 'public', 'lib']; | 29 | $dossiersCibles = ['model', 'view', 'controller', 'public', 'lib']; |
| 30 | $fichiersALaRacine = ['*.php', '.htaccess', '*.txt']; // robots? | 30 | $fichiersALaRacine = ['*.php', '.htaccess', '.gitignore', '*.txt']; // robots? |
| 31 | 31 | ||
| 32 | createZip($cheminDestination, $nomFichier, $dossiersCibles, $fichiersALaRacine); | 32 | createZip($cheminDestination, $nomFichier, $dossiersCibles, $fichiersALaRacine); |
| 33 | } | 33 | } |
| @@ -35,7 +35,7 @@ function createZipMelainePHP() | |||
| 35 | 35 | ||
| 36 | // les deux premiers paramètres concernent le fichier créé | 36 | // les deux premiers paramètres concernent le fichier créé |
| 37 | // le quatrième est optionnel et concerne les fichiers à la racine | 37 | // le quatrième est optionnel et concerne les fichiers à la racine |
| 38 | function createZip($destinationPath, $zipFileName, array $targetDirectories, array $allPattern = []) | 38 | function createZip(string $destinationPath, string $zipFileName, array $targetDirectories, array $allPattern = []): void |
| 39 | { | 39 | { |
| 40 | global $archiveFormat; // choix du format | 40 | global $archiveFormat; // choix du format |
| 41 | $zipFileName = $zipFileName . '.' . $archiveFormat; | 41 | $zipFileName = $zipFileName . '.' . $archiveFormat; |
| @@ -100,7 +100,7 @@ function createZip($destinationPath, $zipFileName, array $targetDirectories, arr | |||
| 100 | } | 100 | } |
| 101 | 101 | ||
| 102 | 102 | ||
| 103 | function restoreData($path) | 103 | function restoreData(string $path): string |
| 104 | { | 104 | { |
| 105 | global $archiveFormat; | 105 | global $archiveFormat; |
| 106 | $message = ''; | 106 | $message = ''; |
| @@ -157,7 +157,7 @@ function restoreData($path) | |||
| 157 | } | 157 | } |
| 158 | 158 | ||
| 159 | 159 | ||
| 160 | function pageRestauration($from) | 160 | function pageRestauration(): void |
| 161 | { | 161 | { |
| 162 | $title = 'Restauration des données'; | 162 | $title = 'Restauration des données'; |
| 163 | $message = ''; | 163 | $message = ''; |
| @@ -207,7 +207,7 @@ function pageRestauration($from) | |||
| 207 | } | 207 | } |
| 208 | 208 | ||
| 209 | // upload AJAX d'un zip en morceaux dans file_upload.js | 209 | // upload AJAX d'un zip en morceaux dans file_upload.js |
| 210 | function uploadChunkAndMerge() // appel dans ajax.php | 210 | function uploadChunkAndMerge(): void // appel dans ajax.php |
| 211 | { | 211 | { |
| 212 | // $_GET['chunk_name'] n'est pas utilisé pour l'instant | 212 | // $_GET['chunk_name'] n'est pas utilisé pour l'instant |
| 213 | 213 | ||
| @@ -264,12 +264,12 @@ elseif(isset($_SESSION) && isset($_GET['action'])) | |||
| 264 | // sauvegarde du dossier 'data' | 264 | // sauvegarde du dossier 'data' |
| 265 | if($_GET['action'] == 'sauvegarde') | 265 | if($_GET['action'] == 'sauvegarde') |
| 266 | { | 266 | { |
| 267 | pageSauvegarde($_GET['from']); | 267 | pageSauvegarde(); |
| 268 | } | 268 | } |
| 269 | // restauration avec une sauvegarde | 269 | // restauration avec une sauvegarde |
| 270 | elseif($_GET['action'] == 'restauration') | 270 | elseif($_GET['action'] == 'restauration') |
| 271 | { | 271 | { |
| 272 | pageRestauration($_GET['from']); | 272 | pageRestauration(); |
| 273 | } | 273 | } |
| 274 | else | 274 | else |
| 275 | { | 275 | { |
