From e811660d7cc99d69076637d405e4eda24f364f51 Mon Sep 17 00:00:00 2001 From: fredtempez Date: Sun, 17 Mar 2024 12:53:04 +0100 Subject: [PATCH] =?UTF-8?q?13.1.08=20mise=C3=A0=20jour=20automatis=C3=A9e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGES.md | 1 + core/module/config/tool/autobackup.php | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 core/module/config/tool/autobackup.php diff --git a/CHANGES.md b/CHANGES.md index 0e6fa285..52d90e08 100755 --- a/CHANGES.md +++ b/CHANGES.md @@ -6,6 +6,7 @@ ### Amélioration - Sauvegarde de l'état des sélecteurs dans les tables des fontes et des utilisateurs. +- Fournit un outil de mise à jour automatisé. ## Version 13.1.07 diff --git a/core/module/config/tool/autobackup.php b/core/module/config/tool/autobackup.php new file mode 100644 index 00000000..0b919a85 --- /dev/null +++ b/core/module/config/tool/autobackup.php @@ -0,0 +1,26 @@ +open('../../../../site/backup/' . $fileName, ZipArchive::CREATE | ZipArchive::OVERWRITE); +$directory = '../../../../site'; +$files = new RecursiveIteratorIterator( + new RecursiveCallbackFilterIterator( + new RecursiveDirectoryIterator( + $directory, + RecursiveDirectoryIterator::SKIP_DOTS + ), + function ($fileInfo, $key, $iterator) use ($filter) { + return $fileInfo->isFile() || !in_array($fileInfo->getBaseName(), $filter); + } + ) +); +foreach ($files as $name => $file) { + if (!$file->isDir()) { + $filePath = $file->getRealPath(); + $relativePath = substr($filePath, strlen(realpath($directory)) + 1); + $zip->addFile($filePath, $relativePath); + } +} +$zip->close(); \ No newline at end of file