From 9d8f884e18d0d90d576fa06ef09bcd82f5cd606a Mon Sep 17 00:00:00 2001 From: Luca Date: Sun, 3 Mar 2024 17:52:50 +0100 Subject: [PATCH] Aggiunta esclusioni da backup del db --- modules/aggiornamenti/checksum.php | 9 +++++++- modules/backups/actions.php | 9 +++++++- modules/backups/edit.php | 35 +++++++++++++++--------------- 3 files changed, 33 insertions(+), 20 deletions(-) diff --git a/modules/aggiornamenti/checksum.php b/modules/aggiornamenti/checksum.php index a421b9cae..c7cb59500 100644 --- a/modules/aggiornamenti/checksum.php +++ b/modules/aggiornamenti/checksum.php @@ -16,6 +16,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +use Models\OperationLog; include_once __DIR__.'/../../core.php'; @@ -40,7 +41,7 @@ $(document).ready(function () { loader.show(); content.html(""); - content.load("'.$structure->fileurl($file).'?effettua_controllo=1", function() { + content.load("'.$structure->fileurl($file).'?effettua_controllo=1&id_module='.$id_module.'", function() { loader.hide(); }); }) @@ -71,9 +72,11 @@ foreach ($checksum as $file => $md5) { $errors[] = $file; } } +OperationLog::setInfo('id_module', $id_module); // Schermata di visualizzazione degli errori if (!empty($errors)) { + OperationLog::setInfo('options', 'KO'); echo '

'.tr("Segue l'elenco dei file che presentano checksum diverso rispetto a quello registrato nella versione ufficiale").'.

@@ -105,8 +108,12 @@ if (!empty($errors)) { '; } else { + + OperationLog::setInfo('options', 'OK'); + echo '
'.tr('Nessun file con problemi di integrità').'.
'; } +OperationLog::build('effettua_controllo'); \ No newline at end of file diff --git a/modules/backups/actions.php b/modules/backups/actions.php index b80d4d458..ff5d367ac 100755 --- a/modules/backups/actions.php +++ b/modules/backups/actions.php @@ -57,8 +57,15 @@ switch (filter('op')) { case 'backup': $ignore_dirs = []; - if (!empty(filter('ignore_dirs'))){ + + /*if (!empty(filter('ignore_dirs'))){ $ignore_dirs = explode(',', filter('ignore_dirs')); + }*/ + + if (filter('exclude') == 'exclude_attachments'){ + $ignore_dirs[] = 'files'; + }else if (filter('exclude') == 'only_database'){ + $ignore_dirs = ['vendor','update','templates','src','plugins','modules','logs','locale','lib','include','files','config','assets','api']; } try { diff --git a/modules/backups/edit.php b/modules/backups/edit.php index 184d45103..7f40e010f 100755 --- a/modules/backups/edit.php +++ b/modules/backups/edit.php @@ -21,6 +21,8 @@ include_once __DIR__.'/../../core.php'; $backups = Backup::getList(); + + // Controllo sul requisito ZIP if (!extension_loaded('zip')) { echo " @@ -82,25 +84,34 @@ function restore() { } // Creazione backup -function creaBackup(button, ignore_dirs = \'\'){ +function creaBackup(button){ swal({ - title: "'.tr('Nuovo backup').'", - text: "'.tr('Sei sicuro di voler creare un nuovo backup?').'", + title: "'.tr('Creare un nuovo backup?').'", + text: "'.tr('Seleziona cosa escludere dal backup:').'", + input: "select", + inputOptions: { + "exclude_attachments": "📎 '.tr('Allegati').'", + "only_database": "🗃️ '.tr('Tutto tranne database').'" + }, + inputAttributes: { + title: "'.tr('Seleziona cosa escludere dal backup').'" + }, + inputPlaceholder: " '.tr('Non escludere nulla').'", type: "warning", showCancelButton: true, confirmButtonClass: "btn btn-lg btn-success", confirmButtonText: "'.tr('Crea').'", - }).then(function() { + }).then(function(result) { let restore = buttonLoading(button); $("#main_loading").show(); - + let selectedOption = result; $.ajax({ url: globals.rootdir + "/actions.php", type: "GET", data: { id_module: globals.id_module, - ignore_dirs: JSON.parse(JSON.stringify(ignore_dirs)), op: "backup", + exclude: selectedOption }, success: function(data) { $("#main_loading").fadeOut(); @@ -321,18 +332,6 @@ if (!empty($backup_dir)) { - -
-
'; }