parent
491c26e80c
commit
283f5328df
|
@ -144,13 +144,17 @@ class BindAPI
|
|||
|
||||
/**
|
||||
* @param String $domain
|
||||
* @param $panel
|
||||
*
|
||||
* @return bool|void
|
||||
*/
|
||||
function checkNS(String $domain)
|
||||
function checkNS(String $domain, $panel)
|
||||
{
|
||||
$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'],
|
||||
|
@ -166,9 +170,39 @@ class BindAPI
|
|||
type: 'nameserver' . $domain);
|
||||
}
|
||||
if ($result['header'] == 200) {
|
||||
return true;
|
||||
echo COLOR_GREEN . ' OK';
|
||||
} else {
|
||||
return false;
|
||||
echo COLOR_RED . ' missing' . COLOR_DEFAULT;
|
||||
$arguments = $this->parseArguments();
|
||||
if (!empty($arguments['fix']) && $arguments['fix'] == 'yes') {
|
||||
echo 'trying to fix …';
|
||||
$body = [
|
||||
'name' => $domain,
|
||||
'panel_id' => $panel['id']
|
||||
];
|
||||
if (!empty($nameServer['aaaa'])) {
|
||||
$result = $this->checkController->sendCommand(
|
||||
serverName: $nameServer['name'],
|
||||
versionIP: 6,
|
||||
apiKey: $nameServer['apikey'],
|
||||
command: 'domains',
|
||||
type: 'nameserver',
|
||||
post: true,
|
||||
body: $body);
|
||||
} else {
|
||||
$result =$this->checkController->sendCommand(
|
||||
serverName: $nameServer['name'],
|
||||
versionIP: 4,
|
||||
apiKey: $nameServer['apikey'],
|
||||
command: 'domains',
|
||||
type: 'nameserver',
|
||||
post: true,
|
||||
body: $body);
|
||||
}
|
||||
die();
|
||||
} else {
|
||||
echo 'error';
|
||||
}
|
||||
}
|
||||
}
|
||||
echo PHP_EOL;
|
||||
|
@ -208,11 +242,7 @@ class BindAPI
|
|||
foreach ($domains as $domain) {
|
||||
if ($domain->id_parent_domain == 0 && !str_contains(haystack: $domain->domain, needle: $panel['name'])) {
|
||||
echo PHP_EOL . COLOR_DEFAULT . "check: " . COLOR_YELLOW . str_pad(string: $domain->domain, length: $maxDomainName);
|
||||
if ($this->checkNS(domain: $domain->domain)) {
|
||||
echo COLOR_GREEN . ' OK';
|
||||
} else {
|
||||
echo COLOR_RED . 'Missing';
|
||||
}
|
||||
$this->checkNS(domain: $domain->domain, panel: $panel);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -794,8 +824,6 @@ class BindAPI
|
|||
|
||||
$id = intval(value: $this->arguments[1] ?? 0);
|
||||
$name = $arguments['name'] ?? '';
|
||||
print_r(value: $arguments); //findme
|
||||
print("$id: id" . PHP_EOL);
|
||||
$panelID = intval(value: $arguments['panel_id'] ?? 0);
|
||||
$a = $arguments['a'] ?? '';
|
||||
$aaaa = $arguments['aaaa'] ?? '';
|
||||
|
|
Loading…
Reference in New Issue