made changes for panel object instead of array
Signed-off-by: tracer <tracer@24unix.net>
This commit is contained in:
parent
91c12e1855
commit
21b4a412a8
|
@ -13,6 +13,7 @@ define(constant_name: 'COLOR_DEFAULT', value: "\033[39m");
|
||||||
|
|
||||||
|
|
||||||
use App\Entity\Domain;
|
use App\Entity\Domain;
|
||||||
|
use App\Entity\Panel;
|
||||||
use App\Repository\ApikeyRepository;
|
use App\Repository\ApikeyRepository;
|
||||||
use App\Repository\DomainRepository;
|
use App\Repository\DomainRepository;
|
||||||
use App\Repository\NameserverRepository;
|
use App\Repository\NameserverRepository;
|
||||||
|
@ -185,7 +186,7 @@ class BindAPI
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
echo "check all …" . PHP_EOL;
|
echo "check all …" . PHP_EOL;
|
||||||
$panels = $this->panelController->findAll();
|
$panels = $this->panelRepository->findAll();
|
||||||
foreach ($panels as $panel) {
|
foreach ($panels as $panel) {
|
||||||
$this->checkSinglePanel(panel: $panel);
|
$this->checkSinglePanel(panel: $panel);
|
||||||
}
|
}
|
||||||
|
@ -197,16 +198,16 @@ class BindAPI
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function checkSinglePanel(array $panel): void
|
public function checkSinglePanel(Panel $panel): void
|
||||||
{
|
{
|
||||||
echo COLOR_DEFAULT . 'Keyhelp-Panel: ' . COLOR_YELLOW . $panel['name'] . PHP_EOL;
|
echo COLOR_DEFAULT . 'Keyhelp-Panel: ' . COLOR_YELLOW . $panel->getName() . PHP_EOL;
|
||||||
if (!empty($panel['aaaa'])) {
|
if (!empty($panel->getAaaa())) {
|
||||||
try {
|
try {
|
||||||
$result = $this->checkController->sendCommand(
|
$result = $this->checkController->sendCommand(
|
||||||
requestType: 'GET',
|
requestType: 'GET',
|
||||||
serverName: $panel['name'],
|
serverName: $panel->getName(),
|
||||||
versionIP: 6,
|
versionIP: 6,
|
||||||
apiKey: $panel['apikey'],
|
apiKey: $panel->getApikey(),
|
||||||
command: 'domains',
|
command: 'domains',
|
||||||
serverType: 'panel'
|
serverType: 'panel'
|
||||||
);
|
);
|
||||||
|
@ -217,9 +218,9 @@ class BindAPI
|
||||||
try {
|
try {
|
||||||
$result = $this->checkController->sendCommand(
|
$result = $this->checkController->sendCommand(
|
||||||
requestType: 'GET',
|
requestType: 'GET',
|
||||||
serverName: $panel['name'],
|
serverName: $panel->getName(),
|
||||||
versionIP: 4,
|
versionIP: 4,
|
||||||
apiKey: $panel['apikey'],
|
apiKey: $panel->getApikey(),
|
||||||
command: 'domains',
|
command: 'domains',
|
||||||
serverType: 'panel');
|
serverType: 'panel');
|
||||||
} catch (DependencyException|NotFoundException $e) {
|
} catch (DependencyException|NotFoundException $e) {
|
||||||
|
@ -241,14 +242,14 @@ class BindAPI
|
||||||
$maxDomainName = 0;
|
$maxDomainName = 0;
|
||||||
// TODO this is ugly code ↓↓↓
|
// TODO this is ugly code ↓↓↓
|
||||||
foreach ($domains as $domain) {
|
foreach ($domains as $domain) {
|
||||||
if ($this->isValidSecondLevelDomain(domainName: $domain->domain, panel: $panel['name'], parent: $domain->id_parent_domain) && (strlen(string: $domain->domain) > $maxDomainName)) {
|
if ($this->isValidSecondLevelDomain(domainName: $domain->domain, panel: $panel->getName(), parent: $domain->id_parent_domain) && (strlen(string: $domain->domain) > $maxDomainName)) {
|
||||||
$maxDomainName = strlen(string: $domain->domain);
|
$maxDomainName = strlen(string: $domain->domain);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$domainCount = 0;
|
$domainCount = 0;
|
||||||
foreach ($domains as $domain) {
|
foreach ($domains as $domain) {
|
||||||
if ($this->isValidSecondLevelDomain(domainName: $domain->domain, panel: $panel['name'], 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);
|
||||||
$this->checkNS(domainName: $domain->domain, panel: $panel);
|
$this->checkNS(domainName: $domain->domain, panel: $panel);
|
||||||
$domainCount++;
|
$domainCount++;
|
||||||
|
@ -294,28 +295,33 @@ class BindAPI
|
||||||
function checkNS(string $domainName, $panel)
|
function checkNS(string $domainName, $panel)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$nameServers = $this->nameserverController->findAll();
|
$nameServers = $this->nameserverRepository->findAll();
|
||||||
} catch (DependencyException|NotFoundException $e) {
|
} catch (DependencyException|NotFoundException $e) {
|
||||||
echo $e->getMessage();
|
echo $e->getMessage();
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
foreach ($nameServers as $nameServer) {
|
foreach ($nameServers as $nameServer) {
|
||||||
echo COLOR_YELLOW . ' ' . $nameServer['name'];
|
|
||||||
try {
|
try {
|
||||||
if (!empty($nameServer['aaaa'])) {
|
echo COLOR_YELLOW . ' ' . $nameServer->getName();
|
||||||
|
} catch (DependencyException|NotFoundException $e) {
|
||||||
|
echo $e->getMessage();
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
if (!empty($nameServer->getName())) {
|
||||||
$result = $this->checkController->sendCommand(
|
$result = $this->checkController->sendCommand(
|
||||||
requestType: 'GET',
|
requestType: 'GET',
|
||||||
serverName: $nameServer['name'],
|
serverName: $nameServer->getName(),
|
||||||
versionIP: 6,
|
versionIP: 6,
|
||||||
apiKey: $nameServer['apikey'],
|
apiKey: $nameServer->getApikey(),
|
||||||
command: 'domains/' . $domainName,
|
command: 'domains/' . $domainName,
|
||||||
serverType: 'nameserver');
|
serverType: 'nameserver');
|
||||||
} else {
|
} else {
|
||||||
$result = $this->checkController->sendCommand(
|
$result = $this->checkController->sendCommand(
|
||||||
requestType: 'GET',
|
requestType: 'GET',
|
||||||
serverName: $nameServer['name'],
|
serverName: $nameServer->getName(),
|
||||||
versionIP: 4,
|
versionIP: 4,
|
||||||
apiKey: $nameServer['apikey'],
|
apiKey: $nameServer->getApikey(),
|
||||||
command: 'domains',
|
command: 'domains',
|
||||||
serverType: 'nameserver' . $domainName);
|
serverType: 'nameserver' . $domainName);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue