From 641d1aee80aa2b7e9f37e91e7ad611ff729eb491 Mon Sep 17 00:00:00 2001 From: Luca Date: Sun, 3 Mar 2024 12:29:42 +0100 Subject: [PATCH] Rinomino i file zip all'interno della cartella di backup, aggiungendo "COMPLETO" alla fine del nome --- composer.json | 4 ++-- include/init/requirements.php | 14 +++++++++++--- src/Database.php | 4 ++-- update/2_4_55.php | 23 +++++++++++++++++++++++ 4 files changed, 38 insertions(+), 7 deletions(-) diff --git a/composer.json b/composer.json index 1eace5d67..4cd961e95 100755 --- a/composer.json +++ b/composer.json @@ -15,7 +15,7 @@ }], "type": "project", "require": { - "php": "^7.3|^8.0", + "php": "^7.4|^8.0", "ext-curl": "*", "ext-dom": "*", "ext-fileinfo": "*", @@ -144,7 +144,7 @@ "prefer-stable": true, "platform-check": false, "platform": { - "php": "8.0.17" + "php": "8.0.29" }, "allow-plugins": { "kylekatarnls/update-helper": true diff --git a/include/init/requirements.php b/include/init/requirements.php index 32cfefac9..0175e2e87 100755 --- a/include/init/requirements.php +++ b/include/init/requirements.php @@ -242,14 +242,16 @@ foreach ($settings as $name => $values) { ]; } + // MySQL if ($database->isInstalled()) { $db = [ 'mysql_version' => [ 'type' => 'version', - 'description' => (($database->isMySQL)? '5.7.x - 8.0.x' : '10.x'), - 'minimum' => (($database->isMySQL)? '5.7.0' : '10.1.0'), - 'maximum' => (($database->isMySQL)? '8.0.99' : '10.6.99'), + 'warning' => (($database->isMySQL())? false : true), + 'description' => (($database->isMySQL())? '5.7.x - 8.0.x' : '10.x'), + 'minimum' => (($database->isMySQL())? '5.7.0' : '10.1.0'), + 'maximum' => (($database->isMySQL())? '8.0.99' : '10.6.99'), ], 'sort_buffer_size' => [ @@ -283,6 +285,12 @@ foreach ($db as $name => $values) { ]); $status = ((version_compare($database->getMySQLVersion(), $values['minimum'], '>=') && version_compare($database->getMySQLVersion(), $values['maximum'], '<=')) ? 1 : 0); + + if($values['warning'] && $status == 1){ + $status = 0; + $description .= '. '.tr('Al momento MariaDB _MYSQL_VERSION_ non รจ completamente supportato, si consiglia di passare a MySQL.', ['_MYSQL_VERSION_'=>$database->getMySQLVersion()]).''; + } + } else { $type = tr('Impostazione'); diff --git a/src/Database.php b/src/Database.php index 13e6ad6dd..504326955 100755 --- a/src/Database.php +++ b/src/Database.php @@ -229,8 +229,8 @@ class Database extends Util\Singleton */ public function isMySQL() { - $ver = $this->fetchArray('SELECT VERSION()'); - if (preg_match('/MariaDB/', $ver[0]['VERSION()'])) { + $ver = $this->fetchOne('SELECT VERSION()')['VERSION()']; + if (preg_match('/MariaDB/', $ver)) { return false; } else { return true; diff --git a/update/2_4_55.php b/update/2_4_55.php index 69314f53f..e3fc4d1c8 100644 --- a/update/2_4_55.php +++ b/update/2_4_55.php @@ -1,4 +1,6 @@ query('ALTER TABLE `zz_groups` ADD `id_module_start` INT NULL AFTER `editable`'); } + + +if ($backup_dir){ + /* Rinomino i file zip all'interno della cartella di backup, aggiungendo "COMPLETO" alla fine del nome*/ + $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); + + if (strpos($fileName, 'COMPLETO') === false) { + $newFileName = pathinfo($fileName, PATHINFO_FILENAME) . ' COMPLETO.zip'; + $newFilePath = $backup_dir . '/' . $newFileName; + + $filesystem->rename($file, $newFilePath); + } + } +}else{ + echo "Impossibile completare l'aggiornamento. Variabile $backup_dir non impostata.\n"; +} \ No newline at end of file