finished check:domains
Signed-off-by: tracer <tracer@24unix.net>
This commit is contained in:
parent
a3b8de848e
commit
bf9c98e6e7
|
@ -144,8 +144,8 @@ class BindAPI
|
||||||
echo COLOR_YELLOW . "check" . COLOR_DEFAULT . "\t health checks the system can perform" . PHP_EOL;
|
echo COLOR_YELLOW . "check" . COLOR_DEFAULT . "\t health checks the system can perform" . PHP_EOL;
|
||||||
echo COLOR_GREEN . "\t check:permissions" . PHP_EOL;
|
echo COLOR_GREEN . "\t check:permissions" . PHP_EOL;
|
||||||
echo COLOR_GREEN . "\t check:panels {ID} {fix=yes}" . PHP_EOL;
|
echo COLOR_GREEN . "\t check:panels {ID} {fix=yes}" . PHP_EOL;
|
||||||
echo COLOR_GREEN . "\t check:domains {ID} {fix=yes}" . PHP_EOL;
|
echo COLOR_GREEN . "\t check:domains" . PHP_EOL;
|
||||||
echo COLOR_GREEN . "\t check:showinclude" . COLOR_DEFAULT . " Temporary needed until KeyHelp 22.1" . PHP_EOL;
|
echo COLOR_GREEN . "\t check:showincludes" . COLOR_DEFAULT . " Temporary needed until KeyHelp 22.1" . PHP_EOL;
|
||||||
|
|
||||||
|
|
||||||
echo COLOR_YELLOW . "panels" . COLOR_DEFAULT . "\t all Keyhelp systems configured" . PHP_EOL;
|
echo COLOR_YELLOW . "panels" . COLOR_DEFAULT . "\t all Keyhelp systems configured" . PHP_EOL;
|
||||||
|
@ -187,7 +187,8 @@ class BindAPI
|
||||||
match ($subcommand) {
|
match ($subcommand) {
|
||||||
'permissions' => $this->handleCheckPermissions(),
|
'permissions' => $this->handleCheckPermissions(),
|
||||||
'panels' => $this->handleCheckPanels(),
|
'panels' => $this->handleCheckPanels(),
|
||||||
'showincludes' => $this->showIncludes(),
|
'domains' => $this->handleCheckDomains(),
|
||||||
|
'showincludes' => $this->handleCheckShowIncludes(),
|
||||||
};
|
};
|
||||||
} catch (UnhandledMatchError) {
|
} catch (UnhandledMatchError) {
|
||||||
echo 'Unknown action: ' . $subcommand . PHP_EOL;
|
echo 'Unknown action: ' . $subcommand . PHP_EOL;
|
||||||
|
@ -343,12 +344,7 @@ class BindAPI
|
||||||
foreach ($domains as $domain) {
|
foreach ($domains as $domain) {
|
||||||
if ($this->isValidSecondLevelDomain(domainName: $domain->domain, panel: $panel->getName(), parent: $domain->id_parent_domain)) {
|
if ($this->isValidSecondLevelDomain(domainName: $domain->domain, panel: $panel->getName(), parent: $domain->id_parent_domain)) {
|
||||||
echo COLOR_DEFAULT . " Domain: " . COLOR_YELLOW . str_pad(string: $domain->domain, length: $maxDomainName);
|
echo COLOR_DEFAULT . " Domain: " . COLOR_YELLOW . str_pad(string: $domain->domain, length: $maxDomainName);
|
||||||
try {
|
$this->checkNS(domainName: $domain->domain, panel: $panel);
|
||||||
$this->checkNS(domainName: $domain->domain, panel: $panel);
|
|
||||||
} catch (DependencyException|NotFoundException $e) {
|
|
||||||
print($e->getMessage());
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
$domainCount++;
|
$domainCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -392,8 +388,6 @@ class BindAPI
|
||||||
* @param \App\Entity\Panel $panel
|
* @param \App\Entity\Panel $panel
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
* @throws \DI\DependencyException
|
|
||||||
* @throws \DI\NotFoundException
|
|
||||||
*/
|
*/
|
||||||
function checkNS(string $domainName, Panel $panel)
|
function checkNS(string $domainName, Panel $panel)
|
||||||
{
|
{
|
||||||
|
@ -447,8 +441,8 @@ class BindAPI
|
||||||
if (!empty($arguments['fix']) && $arguments['fix'] == 'yes') {
|
if (!empty($arguments['fix']) && $arguments['fix'] == 'yes') {
|
||||||
echo ' trying to fix …';
|
echo ' trying to fix …';
|
||||||
$body = [
|
$body = [
|
||||||
'name' => $domainName,
|
'name' => $domainName,
|
||||||
'panel' => $panel->getName(),
|
'panel' => $panel->getName(),
|
||||||
];
|
];
|
||||||
try {
|
try {
|
||||||
if (!empty($nameServer->getAaaa())) {
|
if (!empty($nameServer->getAaaa())) {
|
||||||
|
@ -1068,9 +1062,7 @@ class BindAPI
|
||||||
echo "Domain: $name already exists." . PHP_EOL;
|
echo "Domain: $name already exists." . PHP_EOL;
|
||||||
exit(1);
|
exit(1);
|
||||||
} else {
|
} else {
|
||||||
if ($this->panelRepository->findByName(name: $panel)) {
|
if (!$this->panelRepository->findByName(name: $panel)) {
|
||||||
$content = $this->domainController->createPanelContent(panel: $panel);
|
|
||||||
} else {
|
|
||||||
echo 'Unknown panel: ' . $panel;
|
echo 'Unknown panel: ' . $panel;
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
@ -1106,8 +1098,6 @@ class BindAPI
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$content = [];
|
|
||||||
if (!empty($panelName)) {
|
if (!empty($panelName)) {
|
||||||
$panel = $this->panelRepository->findByName(name: $panelName);
|
$panel = $this->panelRepository->findByName(name: $panelName);
|
||||||
}
|
}
|
||||||
|
@ -1322,7 +1312,7 @@ class BindAPI
|
||||||
* @throws \DI\DependencyException
|
* @throws \DI\DependencyException
|
||||||
* @throws \DI\NotFoundException
|
* @throws \DI\NotFoundException
|
||||||
*/
|
*/
|
||||||
private function showIncludes()
|
function handleCheckShowIncludes()
|
||||||
{
|
{
|
||||||
$nameservers = $this->nameserverRepository->findAll();
|
$nameservers = $this->nameserverRepository->findAll();
|
||||||
|
|
||||||
|
@ -1348,4 +1338,13 @@ class BindAPI
|
||||||
echo PHP_EOL . 'After the modification feel free to run ' . COLOR_YELLOW . 'named-checkconf' . COLOR_DEFAULT . ' to ensure there were no errors.' . PHP_EOL;
|
echo PHP_EOL . 'After the modification feel free to run ' . COLOR_YELLOW . 'named-checkconf' . COLOR_DEFAULT . ' to ensure there were no errors.' . PHP_EOL;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws \DI\DependencyException
|
||||||
|
* @throws \DI\NotFoundException
|
||||||
|
*/
|
||||||
|
function handleCheckDomains()
|
||||||
|
{
|
||||||
|
$this->domainController->checkDomains();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue