From 78f6cb37515412975ebfa299c9e85ccbde0f1d8b Mon Sep 17 00:00:00 2001 From: DL6ER Date: Thu, 18 Jan 2018 17:09:20 +0100 Subject: [PATCH] Add option to disable logging without flushing logs (for temporary disabling without wanting to nuke the logs). Signed-off-by: DL6ER --- scripts/pi-hole/js/settings.js | 21 +++++++++++++++++++-- scripts/pi-hole/php/savesettings.php | 7 ++++++- settings.php | 15 +++++++++++++-- 3 files changed, 38 insertions(+), 5 deletions(-) diff --git a/scripts/pi-hole/js/settings.js b/scripts/pi-hole/js/settings.js index 0edae1bc..257ab7d4 100644 --- a/scripts/pi-hole/js/settings.js +++ b/scripts/pi-hole/js/settings.js @@ -85,7 +85,7 @@ $(".confirm-flushlogs").confirm({ }); $(".confirm-disablelogging").confirm({ - text: "Note that disabling query logging will render graphs on the web user interface useless. Are you sure you want to disable your logging?", + text: "Note that disabling query logging will render graphs on the web user interface useless. Are you sure you want to disable logging and flush your Pi-hole logs?", title: "Confirmation required", confirm(button) { $("#disablelogsform").submit(); @@ -93,7 +93,7 @@ $(".confirm-disablelogging").confirm({ cancel(button) { // nothing to do }, - confirmButton: "Yes, disable logs", + confirmButton: "Yes, disable logs and flush my logs", cancelButton: "No, go back", post: true, confirmButtonClass: "btn-danger", @@ -101,6 +101,23 @@ $(".confirm-disablelogging").confirm({ dialogClass: "modal-dialog modal-mg" }); +$(".confirm-disablelogging-noflush").confirm({ + text: "Note that disabling query logging will render graphs on the web user interface useless after this point. Are you sure you want to disable logging?", + title: "Confirmation required", + confirm(button) { + $("#disablelogsform-noflush").submit(); + }, + cancel(button) { + // nothing to do + }, + confirmButton: "Yes, disable logs", + cancelButton: "No, go back", + post: true, + confirmButtonClass: "btn-warning", + cancelButtonClass: "btn-success", + dialogClass: "modal-dialog modal-mg" +}); + $(".api-token").confirm({ text: "Make sure that nobody else can scan this code around you. They will have full access to the API without having to know the password. Note that the generation of the QR code will take some time.", title: "Confirmation required", diff --git a/scripts/pi-hole/php/savesettings.php b/scripts/pi-hole/php/savesettings.php index 7b67ffed..64914e77 100644 --- a/scripts/pi-hole/php/savesettings.php +++ b/scripts/pi-hole/php/savesettings.php @@ -278,7 +278,12 @@ function readAdlists() if($_POST["action"] === "Disable") { exec("sudo pihole -l off"); - $success .= "Logging has been disabled"; + $success .= "Logging has been disabled and logs have been flushed"; + } + elseif($_POST["action"] === "Disable-noflush") + { + exec("sudo pihole -l off noflush"); + $success .= "Logging has been disabled, your logs have not been flushed"; } else { diff --git a/settings.php b/settings.php index f6e5de1e..b01d0b25 100644 --- a/settings.php +++ b/settings.php @@ -1149,7 +1149,7 @@ if (isset($_GET['tab']) && in_array($_GET['tab'], array("sysadmin", "blocklists"
- +
@@ -1160,7 +1160,13 @@ if (isset($_GET['tab']) && in_array($_GET['tab'], array("sysadmin", "blocklists"
-
+
+ + + +
+ +
@@ -1188,6 +1194,11 @@ if (isset($_GET['tab']) && in_array($_GET['tab'], array("sysadmin", "blocklists" +
+ + + +