Add a parameter to pidofFTL() function to allow a delay if necessary

Signed-off-by: RD WebDesign <github@rdwebdesign.com.br>
This commit is contained in:
RD WebDesign
2023-01-23 01:39:55 -03:00
parent f6acb8fd3d
commit d0101870ac
3 changed files with 9 additions and 2 deletions
+5 -1
View File
@@ -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');
}
+3
View File
@@ -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';
+1 -1
View File
@@ -241,7 +241,7 @@ if (isset($_GET['tab']) && in_array($_GET['tab'], array('sysadmin', 'dns', 'piho
<div class="row">
<div class="col-lg-12">
<?php
$FTLpid = intval(pidofFTL());
$FTLpid = intval(pidofFTL($FTLrestarted));
if ($FTLpid !== 0) {
$FTLversion = exec('/usr/bin/pihole-FTL version'); ?>
<table class="table table-striped table-bordered nowrap">