13.1.08 miseà jour automatisée

This commit is contained in:
Fred Tempez 2024-03-17 12:53:04 +01:00
parent 10083e7ee8
commit e811660d7c
2 changed files with 27 additions and 0 deletions

View File

@ -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

View File

@ -0,0 +1,26 @@
<?php
// Creation du ZIP
$filter = $filter = ['backup', 'tmp'];
$fileName = date('Y-m-d-H-i-s', time()) . '-rolling-backup.zip';
$zip = new ZipArchive();
$zip->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();