2022-10-03 15:42:57 +02:00
|
|
|
function step(i, data) {
|
2024-09-25 22:00:58 +02:00
|
|
|
var errors = [
|
|
|
|
"<?php echo helper::translate('Préparation de la mise à jour'); ?>",
|
|
|
|
"<?php echo helper::translate('Téléchargement et validation de l\'archive'); ?>",
|
|
|
|
"<?php echo helper::translate('Installation'); ?>",
|
|
|
|
"<?php echo helper::translate('Configuration'); ?>"
|
|
|
|
];
|
|
|
|
$(".installUpdateProgressText").hide();
|
|
|
|
$(".installUpdateProgressText[data-id=" + i + "]").show();
|
2024-02-01 18:57:38 +01:00
|
|
|
|
2023-07-28 16:14:49 +02:00
|
|
|
$("body").css("cursor", "wait");
|
|
|
|
|
2023-03-16 15:13:52 +01:00
|
|
|
$.ajax({
|
2022-10-03 15:42:57 +02:00
|
|
|
type: "POST",
|
|
|
|
url: "<?php echo helper::baseUrl(false); ?>?install/steps",
|
|
|
|
data: {
|
|
|
|
step: i,
|
|
|
|
data: data
|
|
|
|
},
|
|
|
|
success: function (result) {
|
2024-09-25 22:00:58 +02:00
|
|
|
setTimeout(function () {
|
2023-03-16 15:13:52 +01:00
|
|
|
if (4 === i) {
|
|
|
|
$("#installUpdateSuccess").show();
|
2023-07-28 16:14:49 +02:00
|
|
|
$("body").css("cursor", "default");
|
2023-03-16 15:13:52 +01:00
|
|
|
$("#installUpdateEnd").removeClass("disabled");
|
|
|
|
$("#installUpdateProgress").hide();
|
|
|
|
} else {
|
|
|
|
step(i + 1, result.data);
|
|
|
|
}
|
2024-09-25 22:00:58 +02:00
|
|
|
}, 2000);
|
2022-10-03 15:42:57 +02:00
|
|
|
},
|
|
|
|
error: function (xhr) {
|
2024-09-25 21:41:08 +02:00
|
|
|
// Balance tout dans la console
|
|
|
|
console.log("Erreur à l'étape :", i);
|
|
|
|
console.log("Détails de l'erreur :", xhr.responseText);
|
|
|
|
console.log("Messages d'erreurs :", errors);
|
|
|
|
// Appel de la nouvelle fonction d'erreur
|
|
|
|
showError(i, errors);
|
2022-10-03 15:42:57 +02:00
|
|
|
}
|
2023-03-16 15:13:52 +01:00
|
|
|
});
|
2022-10-03 15:42:57 +02:00
|
|
|
}
|
2023-03-16 15:13:52 +01:00
|
|
|
|
2024-09-25 21:41:08 +02:00
|
|
|
function showError(step, errors) {
|
2023-07-28 16:14:49 +02:00
|
|
|
$("body").css("cursor", "default");
|
2023-07-24 11:32:58 +02:00
|
|
|
$("#installUpdateErrorStep").text(errors[step] + " (étape n°" + step + ")");
|
2023-03-16 15:13:52 +01:00
|
|
|
$("#installUpdateError").show();
|
|
|
|
$("#installUpdateEnd").removeClass("disabled");
|
|
|
|
$("#installUpdateProgress").hide();
|
2023-07-22 22:22:40 +02:00
|
|
|
|
2024-09-25 21:41:08 +02:00
|
|
|
// Affiche un message générique demandant de consulter la console
|
|
|
|
$("#installUpdateErrorMessage").html("Une erreur est survenue. Veuillez consulter la console du navigateur pour plus de détails.");
|
2023-03-16 15:13:52 +01:00
|
|
|
}
|
|
|
|
|
2023-07-22 22:22:40 +02:00
|
|
|
$(window).on("load", function () {
|
2023-03-16 15:13:52 +01:00
|
|
|
step(1, null);
|
2024-09-25 22:00:58 +02:00
|
|
|
});
|