Automatically restart DNS resolver when privacy level is lowered

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER
2018-11-10 08:38:55 +01:00
parent 26824d2c45
commit 8c08ec2a10
2 changed files with 19 additions and 2 deletions

View File

@@ -687,8 +687,25 @@ function readAdlists()
$level = intval($_POST["privacylevel"]);
if($level >= 0 && $level <= 4)
{
// Check if privacylevel is already set
if (isset($piholeFTLConf["PRIVACYLEVEL"])) {
$privacylevel = intval($piholeFTLConf["PRIVACYLEVEL"]);
} else {
$privacylevel = 0;
}
// Store privacy level
exec("sudo pihole -a privacylevel ".$level);
$success .= "The privacy level has been updated";
if($privacylevel > $level)
{
exec("sudo pihole -a restartdns");
$success .= "The privacy level has been decreased and the DNS resolver has been restarted";
}
else
{
$success .= "The privacy level has been increased";
}
}
else
{