Fix multiple restarts while importing with Teleporter

Signed-off-by: Christian König <ckoenig@posteo.de>
This commit is contained in:
Christian König
2023-02-02 23:37:19 +01:00
parent ef5dc34de6
commit 7373cc2675
2 changed files with 10 additions and 6 deletions

View File

@@ -220,7 +220,7 @@ function getCustomDNSEntries()
return $entries;
}
function addCustomDNSEntry($ip = '', $domain = '', $reload = '', $json = true)
function addCustomDNSEntry($ip = '', $domain = '', $reload = '', $json = true, $teleporter = false)
{
try {
if (isset($_REQUEST['ip'])) {
@@ -279,7 +279,8 @@ function addCustomDNSEntry($ip = '', $domain = '', $reload = '', $json = true)
foreach ($domains as $domain) {
pihole_execute('-a addcustomdns '.$ip.' '.$domain.' '.$reload);
}
if ($num > 0) {
// restart only if not called from teleporter.php as it handles restarts itself
if (($num > 0) && (!$teleporter)) {
pihole_execute('restartdns');
}
@@ -397,7 +398,7 @@ function getCustomCNAMEEntries()
return $entries;
}
function addCustomCNAMEEntry($domain = '', $target = '', $reload = '', $json = true)
function addCustomCNAMEEntry($domain = '', $target = '', $reload = '', $json = true, $teleporter = false)
{
try {
if (isset($_REQUEST['domain'])) {
@@ -460,7 +461,8 @@ function addCustomCNAMEEntry($domain = '', $target = '', $reload = '', $json = t
pihole_execute('-a addcustomcname '.$d.' '.$target.' '.$reload);
}
if ($num > 0) {
// restart only if not called from teleporter.php as it handles restarts itself
if (($num > 0) && (!$teleporter)) {
pihole_execute('restartdns');
}