mirror of
https://github.com/pi-hole/web.git
synced 2024-12-06 19:36:21 +01:00
Also use variable to disable reload in delteALL functions
Signed-off-by: yubiuser <ckoenig@posteo.de>
This commit is contained in:
@@ -278,14 +278,17 @@ function deleteCustomDNSEntry()
|
||||
}
|
||||
}
|
||||
|
||||
function deleteAllCustomDNSEntries()
|
||||
function deleteAllCustomDNSEntries($reload="")
|
||||
{
|
||||
try
|
||||
{
|
||||
if(isset($_REQUEST['reload']))
|
||||
$reload = $_REQUEST['reload'];
|
||||
|
||||
$existingEntries = getCustomDNSEntries();
|
||||
// passing false to pihole_execute stops pihole from reloading after each enty has been deleted
|
||||
foreach ($existingEntries as $entry) {
|
||||
pihole_execute("-a removecustomdns ".$entry->ip." ".$entry->domain." false");
|
||||
pihole_execute("-a removecustomdns ".$entry->ip." ".$entry->domain." ".$reload);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -427,14 +430,17 @@ function deleteCustomCNAMEEntry()
|
||||
}
|
||||
}
|
||||
|
||||
function deleteAllCustomCNAMEEntries()
|
||||
function deleteAllCustomCNAMEEntries($reload="")
|
||||
{
|
||||
try
|
||||
{
|
||||
if(isset($_REQUEST['reload']))
|
||||
$reload = $_REQUEST['reload'];
|
||||
|
||||
$existingEntries = getCustomCNAMEEntries();
|
||||
// passing false to pihole_execute stops pihole from reloading after each enty has been deleted
|
||||
foreach ($existingEntries as $entry) {
|
||||
pihole_execute("-a removecustomcname ".$entry->domain." ".$entry->target." false");
|
||||
pihole_execute("-a removecustomcname ".$entry->domain." ".$entry->target." ".$reload);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -519,14 +519,14 @@ if(isset($_POST["action"]))
|
||||
if(isset($_POST["localdnsrecords"]) && $file->getFilename() === "custom.list")
|
||||
{
|
||||
ob_start();
|
||||
$reload="false";
|
||||
if($flushtables) {
|
||||
// Defined in func.php included via auth.php
|
||||
// will not restart Pi-hole
|
||||
deleteAllCustomDNSEntries();
|
||||
// passing reload="false" will not restart Pi-hole
|
||||
deleteAllCustomDNSEntries($reload);
|
||||
}
|
||||
$num = 0;
|
||||
$localdnsrecords = process_file(file_get_contents($file));
|
||||
$reload="false";
|
||||
foreach($localdnsrecords as $record) {
|
||||
list($ip,$domain) = explode(" ",$record);
|
||||
if(addCustomDNSEntry($ip, $domain, $reload, false))
|
||||
@@ -543,15 +543,15 @@ if(isset($_POST["action"]))
|
||||
if(isset($_POST["localcnamerecords"]) && $file->getFilename() === "05-pihole-custom-cname.conf")
|
||||
{
|
||||
ob_start();
|
||||
$reload="false";
|
||||
if($flushtables) {
|
||||
// Defined in func.php included via auth.php
|
||||
// will not restart Pi-hole
|
||||
deleteAllCustomCNAMEEntries();
|
||||
//passing reload="false" will not restart Pi-hole
|
||||
deleteAllCustomCNAMEEntries($reload);
|
||||
}
|
||||
|
||||
$num = 0;
|
||||
$localcnamerecords = process_file(file_get_contents($file));
|
||||
$reload="false";
|
||||
foreach($localcnamerecords as $record) {
|
||||
$line = str_replace("cname=","", $record);
|
||||
$line = str_replace("\r","", $line);
|
||||
|
||||
Reference in New Issue
Block a user