From d0101870ac5f2207f601571eb0a87e12e9f90fd0 Mon Sep 17 00:00:00 2001 From: RD WebDesign Date: Mon, 23 Jan 2023 01:39:55 -0300 Subject: [PATCH] Add a parameter to pidofFTL() function to allow a delay if necessary Signed-off-by: RD WebDesign --- scripts/pi-hole/php/func.php | 6 +++++- scripts/pi-hole/php/savesettings.php | 3 +++ settings.php | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/scripts/pi-hole/php/func.php b/scripts/pi-hole/php/func.php index d10ad9bf..7cf75634 100644 --- a/scripts/pi-hole/php/func.php +++ b/scripts/pi-hole/php/func.php @@ -693,8 +693,12 @@ function convertUnicodeToIDNA($unicode) } // Return PID of FTL (used in settings.php) -function pidofFTL() +function pidofFTL($add_delay = false) { + if ($add_delay) { + usleep(100000); + } + return shell_exec('pidof pihole-FTL'); } diff --git a/scripts/pi-hole/php/savesettings.php b/scripts/pi-hole/php/savesettings.php index 41f03a64..c4ba3c17 100644 --- a/scripts/pi-hole/php/savesettings.php +++ b/scripts/pi-hole/php/savesettings.php @@ -197,6 +197,7 @@ $DNSserverslist = readDNSserversList(); $error = ''; $success = ''; +$FTLrestarted = false; if (isset($_POST['field'])) { // Handle CSRF @@ -445,6 +446,7 @@ if (isset($_POST['field'])) { case 'restartdns': pihole_execute('-a restartdns'); + $FTLrestarted = true; $success = 'The DNS server has been restarted'; break; @@ -554,6 +556,7 @@ if (isset($_POST['field'])) { if ($privacylevel > $level) { pihole_execute('-a restartdns'); + $FTLrestarted = true; $success .= 'The privacy level has been decreased and the DNS resolver has been restarted'; } elseif ($privacylevel < $level) { $success .= 'The privacy level has been increased'; diff --git a/settings.php b/settings.php index 5f9ed866..21f3cc1e 100644 --- a/settings.php +++ b/settings.php @@ -241,7 +241,7 @@ if (isset($_GET['tab']) && in_array($_GET['tab'], array('sysadmin', 'dns', 'piho