2024-02-08 11:34:56 +01:00
|
|
|
<?php
|
2024-03-03 12:29:42 +01:00
|
|
|
use Symfony\Component\Filesystem\Filesystem as SymfonyFilesystem;
|
|
|
|
include __DIR__.'/../config.inc.php';
|
2024-02-08 11:34:56 +01:00
|
|
|
|
2024-02-19 19:03:55 +01:00
|
|
|
// File e cartelle deprecate
|
|
|
|
$files = [
|
|
|
|
'assets/src/js/wacom/sigCaptDialog/libs/',
|
2024-03-06 14:54:03 +01:00
|
|
|
'modules/impianti/plugins/',
|
|
|
|
'modules/voci_servizio/'
|
2024-02-19 19:03:55 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
foreach ($files as $key => $value) {
|
|
|
|
$files[$key] = realpath(base_dir().'/'.$value);
|
|
|
|
}
|
|
|
|
|
|
|
|
delete($files);
|
|
|
|
|
2024-02-09 12:08:55 +01:00
|
|
|
/* Fix per file sql di update aggiornato dopo rilascio 2.4.35 */
|
2024-02-08 11:34:56 +01:00
|
|
|
$has_column = null;
|
|
|
|
$col_righe = $database->fetchArray('SHOW COLUMNS FROM `zz_groups`');
|
|
|
|
$has_column = array_search('id_module_start', array_column($col_righe, 'Field'));
|
|
|
|
if (empty($has_column)) {
|
|
|
|
$database->query('ALTER TABLE `zz_groups` ADD `id_module_start` INT NULL AFTER `editable`');
|
|
|
|
}
|
2024-03-03 12:29:42 +01:00
|
|
|
|
|
|
|
|
|
|
|
if ($backup_dir){
|
2024-03-03 18:42:16 +01:00
|
|
|
/* Rinomino i file zip all'interno della cartella di backup, aggiungendo "FULL" alla fine del nome*/
|
2024-03-03 12:29:42 +01:00
|
|
|
$filesystem = new SymfonyFilesystem();
|
|
|
|
//glob viene utilizzata per ottenere la lista dei file zip all'interno della cartella $backup_dir.
|
|
|
|
$files = glob($backup_dir . '/*.zip');
|
|
|
|
|
|
|
|
foreach ($files as $file) {
|
|
|
|
$fileName = basename($file);
|
|
|
|
|
2024-03-03 18:42:16 +01:00
|
|
|
if (strpos($fileName, 'FULL') === false) {
|
|
|
|
$newFileName = pathinfo($fileName, PATHINFO_FILENAME) . ' FULL.zip';
|
2024-03-03 12:29:42 +01:00
|
|
|
$newFilePath = $backup_dir . '/' . $newFileName;
|
|
|
|
|
|
|
|
$filesystem->rename($file, $newFilePath);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
echo "Impossibile completare l'aggiornamento. Variabile <b>$backup_dir</b> non impostata.\n";
|
|
|
|
}
|