public receiveSubdomains ( ) : Array | ||
return | Array |
public function receiveSubdomains()
{
if (defined('CRON')) {
$subdomainsFile = file_get_contents('/usr/local/directadmin/data/users/' . $this->account->getUsername() . '/domains/' . $this->getDomain() . '.subdomains');
$subdomains = ['www.' . $this->getDomain()];
foreach (explode("\n", $subdomainsFile) as $subdomain) {
$subdomains[] = $subdomain . '.' . $this->getDomain();
$subdomains[] = 'www.' . $subdomain . '.' . $this->getDomain();
}
} else {
$sock = $this->getSocket();
$sock->set_method('POST');
$sock->query('/CMD_API_SUBDOMAIN', ['domain' => $_SERVER['SESSION_SELECTED_DOMAIN']]);
$result = $sock->fetch_parsed_body();
$subdomains = ['www.' . $this->getDomain()];
if (isset($result['list'])) {
foreach ($result['list'] as $subdomain) {
$subdomains[] = $subdomain . '.' . $this->getDomain();
$subdomains[] = 'www.' . $subdomain . '.' . $this->getDomain();
}
}
}
return $subdomains;
}