From fd4175987b159554a4d81f826fa26d48fbf92783 Mon Sep 17 00:00:00 2001 From: tracer Date: Wed, 17 Apr 2024 13:34:01 +0200 Subject: [PATCH] fixed bug when in domain refresh --- composer.json | 2 +- src/Controller/CLIController.php | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/composer.json b/composer.json index abcfe78..e9f7dd7 100644 --- a/composer.json +++ b/composer.json @@ -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", diff --git a/src/Controller/CLIController.php b/src/Controller/CLIController.php index e7b663b..13256df 100644 --- a/src/Controller/CLIController.php +++ b/src/Controller/CLIController.php @@ -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) {