effacement du dossier des sauvegarde auto
This commit is contained in:
parent
e37460f4f8
commit
28988342a3
@ -19,6 +19,7 @@ class config extends common {
|
||||
public static $actions = [
|
||||
'backup' => self::GROUP_ADMIN,
|
||||
'copyBackups'=> self::GROUP_ADMIN,
|
||||
'delBackups'=> self::GROUP_ADMIN,
|
||||
'configMetaImage' => self::GROUP_ADMIN,
|
||||
'generateFiles' => self::GROUP_ADMIN,
|
||||
'index' => self::GROUP_ADMIN,
|
||||
@ -593,7 +594,7 @@ class config extends common {
|
||||
$this->generateFiles();
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => 'Configuration',
|
||||
'title' => 'Configuration du site',
|
||||
'view' => 'index',
|
||||
'notification' => 'Modifications enregistrées ' ,
|
||||
'state' => true
|
||||
@ -625,7 +626,7 @@ class config extends common {
|
||||
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => 'Configuration',
|
||||
'title' => 'Configuration du site',
|
||||
'view' => 'index'
|
||||
]);
|
||||
}
|
||||
@ -725,7 +726,7 @@ class config extends common {
|
||||
file_put_contents(self::DATA_DIR . 'journal.log',$d);
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => 'Configuration',
|
||||
'title' => 'Configuration du site',
|
||||
'view' => 'index',
|
||||
'notification' => 'Journal réinitialisé avec succès',
|
||||
'state' => true
|
||||
@ -733,7 +734,7 @@ class config extends common {
|
||||
} else {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => 'Configuration',
|
||||
'title' => 'Configuration du site',
|
||||
'view' => 'index',
|
||||
'notification' => 'Aucun journal à effacer',
|
||||
'state' => false
|
||||
@ -761,7 +762,7 @@ class config extends common {
|
||||
} else {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => 'Configuration',
|
||||
'title' => 'Configuration du site',
|
||||
'view' => 'index',
|
||||
'notification' => 'Aucun fichier journal à télécharger',
|
||||
'state' => false
|
||||
@ -798,7 +799,7 @@ class config extends common {
|
||||
} else {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => 'Configuration',
|
||||
'title' => 'Configuration du site',
|
||||
'view' => 'index',
|
||||
'notification' => 'Aucune liste noire à télécharger',
|
||||
'state' => false
|
||||
@ -815,7 +816,7 @@ class config extends common {
|
||||
$this->setData(['blacklist',[]]);
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => 'Configuration',
|
||||
'title' => 'Configuration du site',
|
||||
'view' => 'index',
|
||||
'notification' => 'Liste noire réinitialisée avec succès',
|
||||
'state' => true
|
||||
@ -823,7 +824,7 @@ class config extends common {
|
||||
} else {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => 'Configuration',
|
||||
'title' => 'Configuration du site',
|
||||
'view' => 'index',
|
||||
'notification' => 'Pas de liste à effacer',
|
||||
'state' => false
|
||||
@ -842,11 +843,37 @@ class config extends common {
|
||||
$this->copyDir(self::BACKUP_DIR, self::FILE_DIR . 'source/backup' );
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => 'Configuration',
|
||||
'title' => 'Configuration du site',
|
||||
'view' => 'index',
|
||||
'notification' => 'Copie terminée',
|
||||
'state' => true
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Vider le dosser des sauvegardes automatisées
|
||||
*/
|
||||
public function delBackups() {
|
||||
$path = realpath(self::BACKUP_DIR);
|
||||
$success = $fail = 0;
|
||||
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path)) as $filename)
|
||||
{
|
||||
if (strpos($filename,'.zip')) {
|
||||
|
||||
$r = unlink($filename);
|
||||
$success = $r === true ? $succes + 1 : $success;
|
||||
$fail = $r === false ? $fail + 1 : $fail;
|
||||
}
|
||||
}
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => 'Configuration du site',
|
||||
'view' => 'index',
|
||||
'notification' => 'Suppression terminée :<br />' . $success . ' fichiers effacé(s) <br />' . $fail . ' échec(s)',
|
||||
'state' => true
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -10,7 +10,17 @@
|
||||
* @link http://zwiicms.fr/
|
||||
*/
|
||||
|
||||
$( document).ready(function() {
|
||||
$(document).ready(function () {
|
||||
|
||||
/**
|
||||
* Confirmation de suppression
|
||||
*/
|
||||
$("#configBackupDelButton").on("click", function () {
|
||||
var _this = $(this);
|
||||
return core.confirm("Êtes-vous sûr de vouloir supprimer les sauvegardes automatisées ?", function () {
|
||||
$(location).attr("href", _this.attr("href"));
|
||||
});
|
||||
});
|
||||
|
||||
// Positionnement inital des options
|
||||
//-----------------------------------------------------------------------------------------------------
|
||||
@ -45,36 +55,36 @@ $( document).ready(function() {
|
||||
$("#connectCaptchaStrongWrapper").addClass("disabled");
|
||||
$("#connectCaptchaStrongWrapper").slideDown();
|
||||
$("#connectCaptchaTypeWrapper").addClass("disabled");
|
||||
$("#connectCaptchaTypeWrapper").slideDown();
|
||||
$("#connectCaptchaTypeWrapper").slideDown();
|
||||
} else {
|
||||
$("#connectCaptchaStrongWrapper").removeClass("disabled");
|
||||
$("#connectCaptchaStrongWrapper").slideUp();
|
||||
$("#connectCaptchaTypeWrapper").removeClass("disabled");
|
||||
$("#connectCaptchaTypeWrapper").slideUp();
|
||||
$( "#connectCaptchaStrong" ).prop( "checked", false );
|
||||
$("#connectCaptchaStrong").prop("checked", false);
|
||||
}
|
||||
|
||||
var configLayout = getCookie("configLayout");
|
||||
if (configLayout == null) {
|
||||
configLayout = "setup";
|
||||
setCookie("configLayout","setup");
|
||||
setCookie("configLayout", "setup");
|
||||
}
|
||||
$("#localeContainer").hide();
|
||||
$("#socialContainer").hide();
|
||||
$("#connectContainer").hide();
|
||||
$("#networkContainer").hide();
|
||||
$("#setupContainer").hide();
|
||||
$("#" + configLayout + "Container" ).show();
|
||||
$("#" + configLayout + "Container").show();
|
||||
$("#config" + capitalizeFirstLetter(configLayout) + "Button").addClass("activeButton");
|
||||
|
||||
|
||||
// Gestion des événements
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
/**
|
||||
* Afficher et masquer options smtp
|
||||
*/
|
||||
$("input[name=smtpEnable]").on("change", function() {
|
||||
$("input[name=smtpEnable]").on("change", function () {
|
||||
if ($("input[name=smtpEnable]").is(':checked')) {
|
||||
$("#smtpParam").addClass("disabled");
|
||||
$("#smtpParam").slideDown();
|
||||
@ -88,7 +98,7 @@ $( document).ready(function() {
|
||||
* Afficher et masquer options Auth
|
||||
*/
|
||||
|
||||
$("select[name=smtpAuth]").on("change", function() {
|
||||
$("select[name=smtpAuth]").on("change", function () {
|
||||
if ($("select[name=smtpAuth]").val() == true) {
|
||||
$("#smtpAuthParam").addClass("disabled");
|
||||
$("#smtpAuthParam").slideDown();
|
||||
@ -102,7 +112,7 @@ $( document).ready(function() {
|
||||
* Options de blocage de connexions
|
||||
* Contrôle la cohérence des sélections et interdit une seule valeur Aucune
|
||||
*/
|
||||
$("select[name=connectAttempt]").on("change", function() {
|
||||
$("select[name=connectAttempt]").on("change", function () {
|
||||
if ($("select[name=connectAttempt]").val() === "999") {
|
||||
$("select[name=connectTimeout]").val(0);
|
||||
} else {
|
||||
@ -111,7 +121,7 @@ $( document).ready(function() {
|
||||
}
|
||||
}
|
||||
});
|
||||
$("select[name=connectTimeout]").on("change", function() {
|
||||
$("select[name=connectTimeout]").on("change", function () {
|
||||
if ($("select[name=connectTimeout]").val() === "0") {
|
||||
$("select[name=connectAttempt]").val(999);
|
||||
} else {
|
||||
@ -124,20 +134,20 @@ $( document).ready(function() {
|
||||
/**
|
||||
* Captcha strong si captcha sélectionné
|
||||
*/
|
||||
$("input[name=connectCaptcha]").on("change", function() {
|
||||
|
||||
$("input[name=connectCaptcha]").on("change", function () {
|
||||
|
||||
if ($("input[name=connectCaptcha]").is(':checked')) {
|
||||
$("#connectCaptchaStrongWrapper").addClass("disabled");
|
||||
$("#connectCaptchaStrongWrapper").slideDown();
|
||||
$("#connectCaptchaTypeWrapper").addClass("disabled");
|
||||
$("#connectCaptchaTypeWrapper").slideDown();
|
||||
|
||||
$("#connectCaptchaTypeWrapper").slideDown();
|
||||
|
||||
} else {
|
||||
$("#connectCaptchaStrongWrapper").removeClass("disabled");
|
||||
$("#connectCaptchaStrongWrapper").slideUp();
|
||||
$("#connectCaptchaTypeWrapper").removeClass("disabled");
|
||||
$("#connectCaptchaTypeWrapper").slideUp();
|
||||
$( "#connectCaptchaStrong" ).prop( "checked", false );
|
||||
$("#connectCaptchaStrong").prop("checked", false);
|
||||
}
|
||||
});
|
||||
|
||||
@ -145,7 +155,7 @@ $( document).ready(function() {
|
||||
/**
|
||||
* Sélection de la page de configuration à afficher
|
||||
*/
|
||||
$("#configSetupButton").on("click", function() {
|
||||
$("#configSetupButton").on("click", function () {
|
||||
$("#localeContainer").hide();
|
||||
$("#socialContainer").hide();
|
||||
$("#connectContainer").hide();
|
||||
@ -156,9 +166,9 @@ $( document).ready(function() {
|
||||
$("#configSocialButton").removeClass("activeButton");
|
||||
$("#configConnectButton").removeClass("activeButton");
|
||||
$("#configNetworkButton").removeClass("activeButton");
|
||||
setCookie("configLayout","setup");
|
||||
setCookie("configLayout", "setup");
|
||||
});
|
||||
$("#configLocaleButton").on("click", function() {
|
||||
$("#configLocaleButton").on("click", function () {
|
||||
$("#setupContainer").hide();
|
||||
$("#socialContainer").hide();
|
||||
$("#connectContainer").hide();
|
||||
@ -169,9 +179,9 @@ $( document).ready(function() {
|
||||
$("#configSocialButton").removeClass("activeButton");
|
||||
$("#configConnectButton").removeClass("activeButton");
|
||||
$("#configNetworkButton").removeClass("activeButton");
|
||||
setCookie("configLayout","locale");
|
||||
setCookie("configLayout", "locale");
|
||||
});
|
||||
$("#configSocialButton").on("click", function() {
|
||||
$("#configSocialButton").on("click", function () {
|
||||
$("#connectContainer").hide();
|
||||
$("#setupContainer").hide();
|
||||
$("#localeContainer").hide();
|
||||
@ -182,9 +192,9 @@ $( document).ready(function() {
|
||||
$("#configSocialButton").addClass("activeButton");
|
||||
$("#configConnectButton").removeClass("activeButton");
|
||||
$("#configNetworkButton").removeClass("activeButton");
|
||||
setCookie("configLayout","social");
|
||||
setCookie("configLayout", "social");
|
||||
});
|
||||
$("#configConnectButton").on("click", function() {
|
||||
$("#configConnectButton").on("click", function () {
|
||||
$("#setupContainer").hide();
|
||||
$("#localeContainer").hide();
|
||||
$("#socialContainer").hide();
|
||||
@ -195,9 +205,9 @@ $( document).ready(function() {
|
||||
$("#configSocialButton").removeClass("activeButton");
|
||||
$("#configConnectButton").addClass("activeButton");
|
||||
$("#configNetworkButton").removeClass("activeButton");
|
||||
setCookie("configLayout","connect");
|
||||
setCookie("configLayout", "connect");
|
||||
});
|
||||
$("#configNetworkButton").on("click", function() {
|
||||
$("#configNetworkButton").on("click", function () {
|
||||
$("#setupContainer").hide();
|
||||
$("#localeContainer").hide();
|
||||
$("#socialContainer").hide();
|
||||
@ -208,49 +218,49 @@ $( document).ready(function() {
|
||||
$("#configSocialButton").removeClass("activeButton");
|
||||
$("#configConnectButton").removeClass("activeButton");
|
||||
$("#configNetworkButton").addClass("activeButton");
|
||||
setCookie("configLayout","network");
|
||||
setCookie("configLayout", "network");
|
||||
});
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Aspect de la souris
|
||||
*/
|
||||
$("#socialMetaImage, #socialSiteMap, #configBackupCopyButton").click(function(event) {
|
||||
*/
|
||||
$("#socialMetaImage, #socialSiteMap, #configBackupCopyButton").click(function (event) {
|
||||
$('body, .button').css('cursor', 'wait');
|
||||
});
|
||||
|
||||
|
||||
// Mise en évidence des erreurs de saisie dans les boutons de sélection
|
||||
var containers = ["setup", "locale", "social", "connect", "network"];
|
||||
$.each( containers, function( index, value ){
|
||||
$.each(containers, function (index, value) {
|
||||
var a = $("div#" + value + "Container").find("input.notice").not(".displayNone");
|
||||
if (a.length > 0) {
|
||||
$("#config" + capitalizeFirstLetter(value) + "Button").addClass("buttonNotice");
|
||||
$("#config" + capitalizeFirstLetter(value) + "Button").addClass("buttonNotice");
|
||||
} else {
|
||||
$("#config" + capitalizeFirstLetter(value) + "Button").removeClass("buttonNotice");
|
||||
$("#config" + capitalizeFirstLetter(value) + "Button").removeClass("buttonNotice");
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
function setCookie(name,value,days) {
|
||||
function setCookie(name, value, days) {
|
||||
var expires = "";
|
||||
if (days) {
|
||||
var date = new Date();
|
||||
date.setTime(date.getTime() + (days*24*60*60*1000));
|
||||
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
|
||||
expires = "; expires=" + date.toUTCString();
|
||||
}
|
||||
document.cookie = name + "=" + (value || "") + expires + "; path=/; samesite=lax";
|
||||
document.cookie = name + "=" + (value || "") + expires + "; path=/; samesite=lax";
|
||||
}
|
||||
|
||||
function getCookie(name) {
|
||||
var nameEQ = name + "=";
|
||||
var ca = document.cookie.split(';');
|
||||
for(var i=0;i < ca.length;i++) {
|
||||
for (var i = 0; i < ca.length; i++) {
|
||||
var c = ca[i];
|
||||
while (c.charAt(0)==' ') c = c.substring(1,c.length);
|
||||
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
|
||||
while (c.charAt(0) == ' ') c = c.substring(1, c.length);
|
||||
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -118,28 +118,38 @@
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="rows textAlignCenter">
|
||||
<div class="col3">
|
||||
<div class="row">
|
||||
<div class="col4 offset1">
|
||||
<?php echo template::button('configBackupButton', [
|
||||
'href' => helper::baseUrl() . 'config/backup',
|
||||
'value' => 'Sauvegarder',
|
||||
'value' => 'Sauvegarder les données du site',
|
||||
'ico' => 'download-cloud'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<div class="col4 offset1">
|
||||
<?php echo template::button('configRestoreButton', [
|
||||
'href' => helper::baseUrl() . 'config/restore',
|
||||
'value' => 'Restaurer',
|
||||
'value' => 'Restaurer les données du site',
|
||||
'ico' => 'upload-cloud'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col4 offset1">
|
||||
<?php echo template::button('configBackupCopyButton', [
|
||||
'href' => helper::baseUrl() . 'config/copyBackups',
|
||||
'value' => 'Copie sauvegardes auto',
|
||||
'value' => 'Copier sauvegardes auto',
|
||||
'ico' => 'docs'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4 offset1">
|
||||
<?php echo template::button('configBackupDelButton', [
|
||||
'href' => helper::baseUrl() . 'config/delBackups',
|
||||
'value' => 'Vider dossier sauvegardes auto',
|
||||
'ico' => 'cancel',
|
||||
'class' => 'buttonRed'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -18,7 +18,7 @@
|
||||
<div class="col1 offset8">
|
||||
<?php echo template::button('userImport', [
|
||||
'href' => helper::baseUrl() . 'user/import',
|
||||
'value' => template::ico('table') ,
|
||||
'value' => template::ico('upload') ,
|
||||
'help' => 'Importer des utilisateurs en masse'
|
||||
]); ?>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user