renamed doains:refresh to domains:update as former update has been dropped
This commit is contained in:
parent
65ea85da39
commit
176bd9dc83
|
@ -2,7 +2,7 @@
|
||||||
"name": "24unix/bindapi",
|
"name": "24unix/bindapi",
|
||||||
"description": "manage Bind9 DNS server via REST API",
|
"description": "manage Bind9 DNS server via REST API",
|
||||||
"version": "2023.0.1",
|
"version": "2023.0.1",
|
||||||
"build_number": "343",
|
"build_number": "344",
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
"name": "Micha Espey",
|
"name": "Micha Espey",
|
||||||
|
|
|
@ -193,13 +193,13 @@ class CLIController
|
||||||
$this->domainsList();
|
$this->domainsList();
|
||||||
}))
|
}))
|
||||||
->addCommand(command: new Command(
|
->addCommand(command: new Command(
|
||||||
name: 'refresh',
|
name: 'update',
|
||||||
callback: function () {
|
callback: function () {
|
||||||
$this->domainsRefresh();
|
$this->domainsUpdate();
|
||||||
},
|
},
|
||||||
// mandatoryParameters: ['name'],
|
// mandatoryParameters: ['name'],
|
||||||
// optionalParameters: ['A=<IPv4>', 'AAAA=<IPv6>', 'apikey=<API-Key>'])))
|
// optionalParameters: ['A=<IPv4>', 'AAAA=<IPv6>', 'apikey=<API-Key>'])))
|
||||||
description: 'Refresh domains')))
|
description: 'Update zone files')))
|
||||||
->addCommandGroup(commandGroup: (new CommandGroup(name: 'dyndns', description: 'handle DynDNS entries'))
|
->addCommandGroup(commandGroup: (new CommandGroup(name: 'dyndns', description: 'handle DynDNS entries'))
|
||||||
->addCommand(command: new Command(
|
->addCommand(command: new Command(
|
||||||
name: 'list',
|
name: 'list',
|
||||||
|
@ -1417,45 +1417,45 @@ class CLIController
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
function domainsUpdate(): void
|
// function domainsUpdate(): void
|
||||||
{
|
// {
|
||||||
// check if we're correctly setup
|
// // check if we're correctly setup
|
||||||
if (!$this->domainController->checkPermissions()) {
|
// if (!$this->domainController->checkPermissions()) {
|
||||||
echo 'You need to setup the bindAPI first.' . PHP_EOL;
|
// echo 'You need to setup the bindAPI first.' . PHP_EOL;
|
||||||
exit(1);
|
// exit(1);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
$id = intval(value: $this->arguments[1] ?? 0);
|
// $id = intval(value: $this->arguments[1] ?? 0);
|
||||||
$name = $this->arguments['name'] ?? '';
|
// $name = $this->arguments['name'] ?? '';
|
||||||
$panelName = $this->arguments['panel'] ?? '';
|
// $panelName = $this->arguments['panel'] ?? '';
|
||||||
|
//
|
||||||
if ($id == 0) {
|
// if ($id == 0) {
|
||||||
echo 'An ID is required' . PHP_EOL;
|
// echo 'An ID is required' . PHP_EOL;
|
||||||
exit(1);
|
// exit(1);
|
||||||
}
|
// }
|
||||||
if (!$domain = $this->domainRepository->findByID(id: $id)) {
|
// if (!$domain = $this->domainRepository->findByID(id: $id)) {
|
||||||
echo "Domain with ID : $id doesn't exist." . PHP_EOL;
|
// echo "Domain with ID : $id doesn't exist." . PHP_EOL;
|
||||||
exit(1);
|
// exit(1);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (!empty($panelName)) {
|
// if (!empty($panelName)) {
|
||||||
$panel = $this->panelRepository->findByName(name: $panelName);
|
// $panel = $this->panelRepository->findByName(name: $panelName);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (empty($name) && empty($panel)) {
|
// if (empty($name) && empty($panel)) {
|
||||||
echo COLOR_DEFAULT . 'No name or panel given, just recreate the config file' . PHP_EOL;
|
// echo COLOR_DEFAULT . 'No name or panel given, just recreate the config file' . PHP_EOL;
|
||||||
$this->domainController->updateSlaveZones();
|
// $this->domainController->updateSlaveZones();
|
||||||
exit(1);
|
// exit(1);
|
||||||
}
|
// }
|
||||||
$newDomain = new Domain(name: $name, panel: $panelName, id: $domain->getId());
|
// $newDomain = new Domain(name: $name, panel: $panelName, id: $domain->getId());
|
||||||
|
//
|
||||||
if ($this->domainRepository->update(domain: $newDomain) !== false) {
|
// if ($this->domainRepository->update(domain: $newDomain) !== false) {
|
||||||
echo 'Domain server has been updated' . PHP_EOL;
|
// echo 'Domain server has been updated' . PHP_EOL;
|
||||||
$this->domainController->updateSlaveZones();
|
// $this->domainController->updateSlaveZones();
|
||||||
} else {
|
// } else {
|
||||||
echo 'Error while updating domain server.' . PHP_EOL;
|
// 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();
|
$panels = $this->panelRepository->findAll();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue