fixed bug when in domain refresh

This commit is contained in:
tracer 2024-04-17 13:34:01 +02:00
parent 2eb96742bb
commit fd4175987b
2 changed files with 7 additions and 7 deletions

View File

@ -2,7 +2,7 @@
"name": "24unix/bindapi",
"description": "manage Bind9 DNS server via REST API",
"version": "2023.0.1",
"build_number": "335",
"build_number": "336",
"authors": [
{
"name": "Micha Espey",

View File

@ -1791,12 +1791,12 @@ class CLIController
if (!$this->quiet) {
echo COLOR_YELLOW . ' ' .str_pad(string: $domain->domain, length: $longestEntry + 1, pad_type: STR_PAD_RIGHT);
}
if ($domain = $this->domainRepository->findByName(name: $domain->domain)) {
$currentPanel = $domain->getPanel();
if ($currentDomain = $this->domainRepository->findByName(name: $domain->domain)) {
$currentPanel = $currentDomain->getPanel();
$panelName = $panel->getName();
if (strcmp(string1: $currentPanel, string2: $panelName)) {
$domain->setPanel(panel: $panelName);
$this->domainRepository->update(domain: $domain);
$currentDomain->setPanel(panel: $panelName);
$this->domainRepository->update(domain: $currentDomain);
if (!$this->quiet) {
echo COLOR_DEFAULT . ' updated to: ' . COLOR_YELLOW . $panelName;
}
@ -1805,13 +1805,13 @@ class CLIController
echo COLOR_GREEN . ' OK' . COLOR_DEFAULT . PHP_EOL;
}
} else {
$newDomain = new Domain(name: $domain->getName(), panel: $panel->getName());
$newDomain = new Domain(name: $domain->domain, panel: $panel->getName());
$result = $this->domainRepository->insert(domain: $newDomain);
if (!$this->quiet) {
echo COLOR_DEFAULT . ' has been created with id ' . COLOR_YELLOW . $result . COLOR_DEFAULT . '.' . PHP_EOL;
}
}
unset($currentDomains[$domain->getName()]);
unset($currentDomains[$domain->domain]);
}
}
if ($domainCount == 0) {