error check on check:panels

Signed-off-by: tracer <tracer@24unix.net>
This commit is contained in:
tracer 2022-01-29 14:55:40 +01:00
parent c5f2d3044e
commit 1567520a5b
1 changed files with 17 additions and 6 deletions

View File

@ -152,9 +152,6 @@ class BindAPI
{
$nameServers = $this->nameserverController->findAll();
foreach($nameServers as $nameServer) {
if ($nameServer['name'] == 'ns1.24unix.net') {
continue;
}
echo COLOR_DEFAULT . ' ' . $nameServer['name'];
if (!empty($nameServer['aaaa'])) {
$result = $this->checkController->sendCommand(serverName: $nameServer['name'],
@ -199,7 +196,6 @@ class BindAPI
post: true,
body: $body);
}
die();
} else {
echo 'error';
}
@ -211,7 +207,9 @@ class BindAPI
function handleCheckPanels()
{
$id = $this->getId();
$parsedArguments = $this->parseArguments();
print_r($this->arguments);
$id = intval(value: $this->arguments[1] ?? 0);
print("id: $id " . PHP_EOL);
if ($id != 0) {
@ -229,10 +227,21 @@ class BindAPI
command: 'domains',
type: 'panel');
}
if ($result['error']) {
echo $result['data'] . PHP_EOL;
exit(1);
}
$domains = json_decode(json: $result['data']);
if ($domains['error']) {
echo $domains['data'];
exit(1);
}
$maxDomainName = 0;
// TODO this is ugly code
foreach ($domains as $domain) {
if (($domain->id_parent_domain == 0 && !str_contains(haystack: $domain->domain, needle: $panel['name'])) && (strlen(string: $domain->domain) > $maxDomainName)) {
$maxDomainName = strlen(string: $domain->domain);
@ -564,6 +573,8 @@ class BindAPI
if (str_contains(haystack: $argument, needle: '=')) {
[$key, $value] = explode(separator: '=', string: $argument);
$arguments[strtolower(string: $key)] = $value;
} else {
$arguments[strtolower(string: $argument)] = $argument;
}
}
return $arguments;