From 176bd9dc83df643c0b5d5ff8554989ecf1a2a9b2 Mon Sep 17 00:00:00 2001 From: tracer Date: Thu, 18 Apr 2024 18:04:25 +0200 Subject: [PATCH] renamed doains:refresh to domains:update as former update has been dropped --- composer.json | 2 +- src/Controller/CLIController.php | 88 ++++++++++++++++---------------- 2 files changed, 45 insertions(+), 45 deletions(-) diff --git a/composer.json b/composer.json index 95e7514..8982a17 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": "343", + "build_number": "344", "authors": [ { "name": "Micha Espey", diff --git a/src/Controller/CLIController.php b/src/Controller/CLIController.php index d0434ce..d6d7c27 100644 --- a/src/Controller/CLIController.php +++ b/src/Controller/CLIController.php @@ -193,13 +193,13 @@ class CLIController $this->domainsList(); })) ->addCommand(command: new Command( - name: 'refresh', + name: 'update', callback: function () { - $this->domainsRefresh(); + $this->domainsUpdate(); }, // mandatoryParameters: ['name'], // optionalParameters: ['A=', 'AAAA=', 'apikey=']))) - description: 'Refresh domains'))) + description: 'Update zone files'))) ->addCommandGroup(commandGroup: (new CommandGroup(name: 'dyndns', description: 'handle DynDNS entries')) ->addCommand(command: new Command( name: 'list', @@ -1417,45 +1417,45 @@ class CLIController /** */ - function domainsUpdate(): void - { - // check if we're correctly setup - if (!$this->domainController->checkPermissions()) { - echo 'You need to setup the bindAPI first.' . PHP_EOL; - exit(1); - } - - $id = intval(value: $this->arguments[1] ?? 0); - $name = $this->arguments['name'] ?? ''; - $panelName = $this->arguments['panel'] ?? ''; - - if ($id == 0) { - echo 'An ID is required' . PHP_EOL; - exit(1); - } - if (!$domain = $this->domainRepository->findByID(id: $id)) { - echo "Domain with ID : $id doesn't exist." . PHP_EOL; - exit(1); - } - - if (!empty($panelName)) { - $panel = $this->panelRepository->findByName(name: $panelName); - } - - if (empty($name) && empty($panel)) { - echo COLOR_DEFAULT . 'No name or panel given, just recreate the config file' . PHP_EOL; - $this->domainController->updateSlaveZones(); - exit(1); - } - $newDomain = new Domain(name: $name, panel: $panelName, id: $domain->getId()); - - if ($this->domainRepository->update(domain: $newDomain) !== false) { - echo 'Domain server has been updated' . PHP_EOL; - $this->domainController->updateSlaveZones(); - } else { - echo 'Error while updating domain server.' . PHP_EOL; - } - } +// function domainsUpdate(): void +// { +// // check if we're correctly setup +// if (!$this->domainController->checkPermissions()) { +// echo 'You need to setup the bindAPI first.' . PHP_EOL; +// exit(1); +// } +// +// $id = intval(value: $this->arguments[1] ?? 0); +// $name = $this->arguments['name'] ?? ''; +// $panelName = $this->arguments['panel'] ?? ''; +// +// if ($id == 0) { +// echo 'An ID is required' . PHP_EOL; +// exit(1); +// } +// if (!$domain = $this->domainRepository->findByID(id: $id)) { +// echo "Domain with ID : $id doesn't exist." . PHP_EOL; +// exit(1); +// } +// +// if (!empty($panelName)) { +// $panel = $this->panelRepository->findByName(name: $panelName); +// } +// +// if (empty($name) && empty($panel)) { +// echo COLOR_DEFAULT . 'No name or panel given, just recreate the config file' . PHP_EOL; +// $this->domainController->updateSlaveZones(); +// exit(1); +// } +// $newDomain = new Domain(name: $name, panel: $panelName, id: $domain->getId()); +// +// if ($this->domainRepository->update(domain: $newDomain) !== false) { +// echo 'Domain server has been updated' . PHP_EOL; +// $this->domainController->updateSlaveZones(); +// } else { +// echo 'Error while updating domain server.' . PHP_EOL; +// } +// } /** @@ -1738,9 +1738,9 @@ class CLIController } - private function domainsRefresh(): void + private function domainsUpdate(): void { - $this->logger->debug(message: "domainsRefresh()"); + $this->logger->debug(message: "domainsUpdate()"); $panels = $this->panelRepository->findAll();