1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2024-12-19 11:45:25 +01:00

Rinomino i file zip all'interno della cartella di backup, aggiungendo "COMPLETO" alla fine del nome

This commit is contained in:
Luca 2024-03-03 12:29:42 +01:00
parent ca0cc77b86
commit 641d1aee80
4 changed files with 38 additions and 7 deletions

View File

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

View File

@ -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 .= '. <i class="fa fa-exclamation-triangle text-danger" ></i><b> '.tr('Al momento MariaDB _MYSQL_VERSION_ non è completamente supportato, si consiglia di passare a MySQL.', ['_MYSQL_VERSION_'=>$database->getMySQLVersion()]).'</b>';
}
} else {
$type = tr('Impostazione');

View File

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

View File

@ -1,4 +1,6 @@
<?php
use Symfony\Component\Filesystem\Filesystem as SymfonyFilesystem;
include __DIR__.'/../config.inc.php';
// File e cartelle deprecate
$files = [
@ -18,3 +20,24 @@ $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`');
}
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 <b>$backup_dir</b> non impostata.\n";
}