Minor enhancements and starting to comply with checkstyle
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
@@ -27,19 +27,19 @@ use Froxlor\Settings;
|
||||
abstract class DnsBase
|
||||
{
|
||||
|
||||
protected $_logger = false;
|
||||
protected $logger = false;
|
||||
|
||||
protected $_ns = array();
|
||||
protected $ns = array();
|
||||
|
||||
protected $_mx = array();
|
||||
protected $mx = array();
|
||||
|
||||
protected $_axfr = array();
|
||||
protected $axfr = array();
|
||||
|
||||
abstract public function writeConfigs();
|
||||
|
||||
public function __construct($logger)
|
||||
{
|
||||
$this->_logger = $logger;
|
||||
$this->logger = $logger;
|
||||
|
||||
if (Settings::Get('system.nameservers') != '') {
|
||||
$nameservers = explode(',', Settings::Get('system.nameservers'));
|
||||
@@ -59,7 +59,7 @@ abstract class DnsBase
|
||||
$nameserver
|
||||
);
|
||||
}
|
||||
$this->_ns[] = array(
|
||||
$this->ns[] = array(
|
||||
'hostname' => $nameserver,
|
||||
'ips' => $nameserver_ips
|
||||
);
|
||||
@@ -72,7 +72,7 @@ abstract class DnsBase
|
||||
if (substr($mxserver, - 1, 1) != '.') {
|
||||
$mxserver .= '.';
|
||||
}
|
||||
$this->_mx[] = $mxserver;
|
||||
$this->mx[] = $mxserver;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ abstract class DnsBase
|
||||
if (Settings::Get('system.axfrservers') != '') {
|
||||
$axfrservers = explode(',', Settings::Get('system.axfrservers'));
|
||||
foreach ($axfrservers as $axfrserver) {
|
||||
$this->_axfr[] = trim($axfrserver);
|
||||
$this->axfr[] = trim($axfrserver);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -151,15 +151,15 @@ abstract class DnsBase
|
||||
if (isset($domains[$domains[$key]['ismainbutsubto']])) {
|
||||
$domains[$domains[$key]['ismainbutsubto']]['children'][] = $domains[$key]['id'];
|
||||
} else {
|
||||
$this->_logger->logAction(CRON_ACTION, LOG_ERR, 'Database inconsistency: domain ' . $domain['domain'] . ' (ID #' . $key . ') is set to to be subdomain to non-existent domain ID #' . $domains[$key]['ismainbutsubto'] . '. No DNS record(s) will be created for this domain.');
|
||||
$this->logger->logAction(CRON_ACTION, LOG_ERR, 'Database inconsistency: domain ' . $domain['domain'] . ' (ID #' . $key . ') is set to to be subdomain to non-existent domain ID #' . $domains[$key]['ismainbutsubto'] . '. No DNS record(s) will be created for this domain.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->_logger->logAction(CRON_ACTION, LOG_DEBUG, str_pad('domId', 9, ' ') . str_pad('domain', 40, ' ') . 'ismainbutsubto ' . str_pad('parent domain', 40, ' ') . "list of child domain ids");
|
||||
$this->logger->logAction(CRON_ACTION, LOG_DEBUG, str_pad('domId', 9, ' ') . str_pad('domain', 40, ' ') . 'ismainbutsubto ' . str_pad('parent domain', 40, ' ') . "list of child domain ids");
|
||||
foreach ($domains as $domain) {
|
||||
$logLine = str_pad($domain['id'], 9, ' ') . str_pad($domain['domain'], 40, ' ') . str_pad($domain['ismainbutsubto'], 15, ' ') . str_pad(((isset($domains[$domain['ismainbutsubto']])) ? $domains[$domain['ismainbutsubto']]['domain'] : '-'), 40, ' ') . join(', ', $domain['children']);
|
||||
$this->_logger->logAction(CRON_ACTION, LOG_DEBUG, $logLine);
|
||||
$this->logger->logAction(CRON_ACTION, LOG_DEBUG, $logLine);
|
||||
}
|
||||
|
||||
return $domains;
|
||||
@@ -172,9 +172,9 @@ abstract class DnsBase
|
||||
$cmdStatus = 1;
|
||||
\Froxlor\FileDir::safe_exec(escapeshellcmd($cmd), $cmdStatus);
|
||||
if ($cmdStatus === 0) {
|
||||
$this->_logger->logAction(CRON_ACTION, LOG_INFO, Settings::Get('system.dns_server') . ' daemon reloaded');
|
||||
$this->logger->logAction(CRON_ACTION, LOG_INFO, Settings::Get('system.dns_server') . ' daemon reloaded');
|
||||
} else {
|
||||
$this->_logger->logAction(CRON_ACTION, LOG_ERR, 'Error while running `' . $cmd . '`: exit code (' . $cmdStatus . ') - please check your system logs');
|
||||
$this->logger->logAction(CRON_ACTION, LOG_ERR, 'Error while running `' . $cmd . '`: exit code (' . $cmdStatus . ') - please check your system logs');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,7 +182,7 @@ abstract class DnsBase
|
||||
{
|
||||
if (Settings::Get('dkim.use_dkim') == '1') {
|
||||
if (! file_exists(\Froxlor\FileDir::makeCorrectDir(Settings::Get('dkim.dkim_prefix')))) {
|
||||
$this->_logger->logAction(CRON_ACTION, LOG_NOTICE, 'mkdir -p ' . escapeshellarg(\Froxlor\FileDir::makeCorrectDir(Settings::Get('dkim.dkim_prefix'))));
|
||||
$this->logger->logAction(CRON_ACTION, LOG_NOTICE, 'mkdir -p ' . escapeshellarg(\Froxlor\FileDir::makeCorrectDir(Settings::Get('dkim.dkim_prefix'))));
|
||||
\Froxlor\FileDir::safe_exec('mkdir -p ' . escapeshellarg(\Froxlor\FileDir::makeCorrectDir(Settings::Get('dkim.dkim_prefix'))));
|
||||
}
|
||||
|
||||
@@ -254,7 +254,7 @@ abstract class DnsBase
|
||||
fclose($dkimkeys_file_handler);
|
||||
|
||||
\Froxlor\FileDir::safe_exec(escapeshellcmd(Settings::Get('dkim.dkimrestart_command')));
|
||||
$this->_logger->logAction(CRON_ACTION, LOG_INFO, 'Dkim-milter reloaded');
|
||||
$this->logger->logAction(CRON_ACTION, LOG_INFO, 'Dkim-milter reloaded');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user