before test on ns3

This commit is contained in:
tracer 2024-04-09 18:45:28 +02:00
parent 6f16cfd76c
commit d62586feb0
4 changed files with 19 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": "327",
"build_number": "328",
"authors": [
{
"name": "Micha Espey",

View File

@ -184,8 +184,9 @@ class CLIController
callback: function () {
$this->domainsRefresh();
},
mandatoryParameters: ['name'],
optionalParameters: ['A=<IPv4>', 'AAAA=<IPv6>', 'apikey=<API-Key>'])))
// mandatoryParameters: ['name'],
// optionalParameters: ['A=<IPv4>', 'AAAA=<IPv6>', 'apikey=<API-Key>'])))
description: 'Refresh domains')))
->addCommandGroup(commandGroup: (new CommandGroup(name: 'dyndns', description: 'handle DynDNS entries'))
->addCommand(command: new Command(
name: 'list',
@ -1717,10 +1718,17 @@ class CLIController
foreach ($domains as $domain) {
$domainCount++;
echo COLOR_YELLOW . ' ' . $domain->domain;
if ($this->domainRepository->findByName(name: $domain->domain)) {
if ($domain = $this->domainRepository->findByName(name: $domain->domain)) {
$currentPanel = $domain->getPanel();
$panelName = $panel->getName();
if ($currentPanel !== $panelName) {
$domain->setPanel(panel: $panelName);
}
$this->domainRepository->update(domain: $domain);
echo COLOR_DEFAULT . ' updated to: ' . COLOR_YELLOW .$panelName;
echo COLOR_GREEN . ' OK' . COLOR_DEFAULT . PHP_EOL;
} else {
$newDomain = new Domain(name: $domain->domain, panel: $panel->getName());
$newDomain = new Domain(name: $domain->getName(), panel: $panel->getName());
$result = $this->domainRepository->insert(domain: $newDomain);
echo COLOR_DEFAULT . ' has been created with id ' . COLOR_YELLOW . $result . COLOR_DEFAULT . '.' . PHP_EOL;
}

View File

@ -63,9 +63,13 @@ class CommandGroupContainer
if ($group = $this->findGroupByName(command: $command)) {
if ($group->exec(subcommand: $subcommand)) {
exit(0);
} else {
echo COLOR_DEFAULT . 'Unknown subcommand ' . COLOR_YELLOW . $subcommand . COLOR_DEFAULT .' for ' . COLOR_YELLOW . $command . COLOR_DEFAULT . '.' . PHP_EOL;
exit(1);
}
} else {
echo COLOR_DEFAULT . 'Unknown subcommand ' . COLOR_YELLOW . $command . ' for ' . $command . COLOR_DEFAULT . '.' . PHP_EOL;
echo COLOR_DEFAULT . 'Unknown subcommand ' . COLOR_YELLOW . $subcommand . COLOR_DEFAULT .' for ' . COLOR_YELLOW . $command . COLOR_DEFAULT . '.' . PHP_EOL;
exit(1);
}
} else {
// check for command group and print available commands

View File

@ -52,7 +52,7 @@ class DomainController
}
fclose(stream: $oFile);
exec(command: '/usr/sbin/named-checkconf', output: $output, result_code: $resultCode);
exec(command: '/usr/bin/named-checkconf', output: $output, result_code: $resultCode);
if ($resultCode != 0) {
echo 'There was an error:' . PHP_EOL;
foreach ($output as $line) {