mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-03 17:27:29 +01:00
Aggiunta esclusioni da backup del db
This commit is contained in:
parent
7c3e8a63d4
commit
9d8f884e18
@ -16,6 +16,7 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
use Models\OperationLog;
|
||||||
|
|
||||||
include_once __DIR__.'/../../core.php';
|
include_once __DIR__.'/../../core.php';
|
||||||
|
|
||||||
@ -40,7 +41,7 @@ $(document).ready(function () {
|
|||||||
loader.show();
|
loader.show();
|
||||||
|
|
||||||
content.html("");
|
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();
|
loader.hide();
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
@ -71,9 +72,11 @@ foreach ($checksum as $file => $md5) {
|
|||||||
$errors[] = $file;
|
$errors[] = $file;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
OperationLog::setInfo('id_module', $id_module);
|
||||||
|
|
||||||
// Schermata di visualizzazione degli errori
|
// Schermata di visualizzazione degli errori
|
||||||
if (!empty($errors)) {
|
if (!empty($errors)) {
|
||||||
|
OperationLog::setInfo('options', 'KO');
|
||||||
echo '
|
echo '
|
||||||
<p>'.tr("Segue l'elenco dei file che presentano checksum diverso rispetto a quello registrato nella versione ufficiale").'.</p>
|
<p>'.tr("Segue l'elenco dei file che presentano checksum diverso rispetto a quello registrato nella versione ufficiale").'.</p>
|
||||||
<div class="alert alert-warning">
|
<div class="alert alert-warning">
|
||||||
@ -105,8 +108,12 @@ if (!empty($errors)) {
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>';
|
</table>';
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
OperationLog::setInfo('options', 'OK');
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
<div class="alert alert-info">
|
<div class="alert alert-info">
|
||||||
<i class="fa fa-info-circle"></i> '.tr('Nessun file con problemi di integrità').'.
|
<i class="fa fa-info-circle"></i> '.tr('Nessun file con problemi di integrità').'.
|
||||||
</div>';
|
</div>';
|
||||||
}
|
}
|
||||||
|
OperationLog::build('effettua_controllo');
|
@ -57,8 +57,15 @@ switch (filter('op')) {
|
|||||||
case 'backup':
|
case 'backup':
|
||||||
|
|
||||||
$ignore_dirs = [];
|
$ignore_dirs = [];
|
||||||
if (!empty(filter('ignore_dirs'))){
|
|
||||||
|
/*if (!empty(filter('ignore_dirs'))){
|
||||||
$ignore_dirs = explode(',', 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 {
|
try {
|
||||||
|
@ -21,6 +21,8 @@ include_once __DIR__.'/../../core.php';
|
|||||||
|
|
||||||
$backups = Backup::getList();
|
$backups = Backup::getList();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Controllo sul requisito ZIP
|
// Controllo sul requisito ZIP
|
||||||
if (!extension_loaded('zip')) {
|
if (!extension_loaded('zip')) {
|
||||||
echo "
|
echo "
|
||||||
@ -82,25 +84,34 @@ function restore() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Creazione backup
|
// Creazione backup
|
||||||
function creaBackup(button, ignore_dirs = \'\'){
|
function creaBackup(button){
|
||||||
swal({
|
swal({
|
||||||
title: "'.tr('Nuovo backup').'",
|
title: "'.tr('Creare un nuovo backup?').'",
|
||||||
text: "'.tr('Sei sicuro di voler 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",
|
type: "warning",
|
||||||
showCancelButton: true,
|
showCancelButton: true,
|
||||||
confirmButtonClass: "btn btn-lg btn-success",
|
confirmButtonClass: "btn btn-lg btn-success",
|
||||||
confirmButtonText: "'.tr('Crea').'",
|
confirmButtonText: "'.tr('Crea').'",
|
||||||
}).then(function() {
|
}).then(function(result) {
|
||||||
let restore = buttonLoading(button);
|
let restore = buttonLoading(button);
|
||||||
$("#main_loading").show();
|
$("#main_loading").show();
|
||||||
|
let selectedOption = result;
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: globals.rootdir + "/actions.php",
|
url: globals.rootdir + "/actions.php",
|
||||||
type: "GET",
|
type: "GET",
|
||||||
data: {
|
data: {
|
||||||
id_module: globals.id_module,
|
id_module: globals.id_module,
|
||||||
ignore_dirs: JSON.parse(JSON.stringify(ignore_dirs)),
|
|
||||||
op: "backup",
|
op: "backup",
|
||||||
|
exclude: selectedOption
|
||||||
},
|
},
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
$("#main_loading").fadeOut();
|
$("#main_loading").fadeOut();
|
||||||
@ -321,18 +332,6 @@ if (!empty($backup_dir)) {
|
|||||||
<a class="btn btn-primary" aria-haspopup="true" aria-expanded="false" onclick="creaBackup(this)">
|
<a class="btn btn-primary" aria-haspopup="true" aria-expanded="false" onclick="creaBackup(this)">
|
||||||
<i class="fa fa-archive"></i> '.tr('Crea backup').'
|
<i class="fa fa-archive"></i> '.tr('Crea backup').'
|
||||||
</a>
|
</a>
|
||||||
<button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
|
||||||
<span class="caret"></span>
|
|
||||||
<span class="sr-only">Toggle Dropdown</span>
|
|
||||||
</button>
|
|
||||||
<ul class="dropdown-menu dropdown-menu-right">
|
|
||||||
<li>
|
|
||||||
<a class="clickable" data-toggle="modal" data-title="'.tr('Crea backup parziale').'" onclick="creaBackup(this, \'files\')">
|
|
||||||
<i class="fa fa-database"></i>'.tr('Crea backup parziale').'
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="clearfix"></div>';
|
<div class="clearfix"></div>';
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user