Only enable/disable those lists where the status should be changed (efficiency + speed)

This commit is contained in:
DL6ER
2016-12-16 15:22:58 +01:00
parent 7b87301e7c
commit 6e7020a8ba
2 changed files with 8 additions and 6 deletions
+7 -5
View File
@@ -328,15 +328,17 @@ function readAdlists(&$list, $listname)
case "adlists":
foreach ($adlistsdefault as $key => $value)
{
if(isset($_POST["adlist-".$key]))
if(isset($_POST["adlist-".$key]) && !$value[0])
{
$action = "enable";
// Is not enabled, but should be
exec("sudo pihole -a adlist enable ".escapeshellcmd ($value[1]));
}
else
elseif(!isset($_POST["adlist-".$key]) && $value[0])
{
$action = "disable";
// Is enabled, but shouldn't be
exec("sudo pihole -a adlist disable ".escapeshellcmd ($value[1]));
}
exec("sudo pihole -a adlist ".$action." ".escapeshellcmd ($value[1]));
}
if(strlen($_POST["newuserlists"]) > 1)