cron scripts: replace fwrite'ing to lockfile by logging
This commit is contained in:
@@ -67,7 +67,6 @@ class bind {
|
||||
|
||||
|
||||
public function writeConfigs() {
|
||||
fwrite($this->debugHandler, ' cron_tasks: Task4 started - Rebuilding froxlor_bind.conf' . "\n");
|
||||
$this->logger->logAction(CRON_ACTION, LOG_INFO, 'Task4 started - Rebuilding froxlor_bind.conf');
|
||||
|
||||
if (!file_exists(makeCorrectDir(Settings::Get('system.bindconf_directory') . '/domains/'))) {
|
||||
@@ -130,22 +129,20 @@ class bind {
|
||||
}
|
||||
}
|
||||
|
||||
fwrite($this->debugHandler,
|
||||
$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\n");
|
||||
"list of child domain ids");
|
||||
foreach ($domains as $domain) {
|
||||
fwrite($this->debugHandler,
|
||||
$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, ' '));
|
||||
foreach ($domain['children'] as $child) {
|
||||
fwrite($this->debugHandler, '$child, ');
|
||||
}
|
||||
fwrite($this->debugHandler, "\n");
|
||||
'-'), 40, ' ') .
|
||||
join(', ', $domain['children']);
|
||||
$this->logger->logAction(CRON_ACTION, LOG_DEBUG, $logLine);
|
||||
}
|
||||
|
||||
foreach ($domains as $domain) {
|
||||
@@ -159,10 +156,8 @@ class bind {
|
||||
$bindconf_file_handler = fopen(makeCorrectFile(Settings::Get('system.bindconf_directory') . '/froxlor_bind.conf'), 'w');
|
||||
fwrite($bindconf_file_handler, $this->_bindconf_file);
|
||||
fclose($bindconf_file_handler);
|
||||
fwrite($this->debugHandler, ' cron_tasks: Task4 - froxlor_bind.conf written' . "\n");
|
||||
$this->logger->logAction(CRON_ACTION, LOG_INFO, 'froxlor_bind.conf written');
|
||||
safe_exec(escapeshellcmd(Settings::Get('system.bindreload_command')));
|
||||
fwrite($this->debugHandler, ' cron_tasks: Task4 - Bind9 reloaded' . "\n");
|
||||
$this->logger->logAction(CRON_ACTION, LOG_INFO, 'Bind9 reloaded');
|
||||
$domains_dir = makeCorrectDir(Settings::Get('system.bindconf_directory') . '/domains/');
|
||||
|
||||
@@ -178,12 +173,12 @@ class bind {
|
||||
&& !in_array($domain_filename, $this->_known_filenames)
|
||||
&& is_file($full_filename)
|
||||
&& file_exists($full_filename)) {
|
||||
fwrite($this->debugHandler, ' cron_tasks: Task4 - unlinking ' . $domain_filename . "\n");
|
||||
$this->logger->logAction(CRON_ACTION, LOG_WARNING, 'Deleting ' . $domain_filename);
|
||||
unlink(makeCorrectFile($domains_dir . '/' . $domain_filename));
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->logger->logAction(CRON_ACTION, LOG_INFO, 'Task4 finished');
|
||||
}
|
||||
|
||||
private function walkDomainList($domain, $domains) {
|
||||
@@ -202,7 +197,7 @@ class bind {
|
||||
$zonefile_handler = fopen($zonefile_name, 'w');
|
||||
fwrite($zonefile_handler, $zonefile.$subzones);
|
||||
fclose($zonefile_handler);
|
||||
fwrite($this->debugHandler, ' cron_tasks: Task4 - `' . $zonefile_name . '` zone written' . "\n");
|
||||
$this->logger->logAction(CRON_ACTION, LOG_INFO, '`' . $zonefile_name . '` zone written');
|
||||
} else {
|
||||
return $this->generateZone($domain);
|
||||
}
|
||||
@@ -600,7 +595,6 @@ class bind {
|
||||
fclose($dkimkeys_file_handler);
|
||||
|
||||
safe_exec(escapeshellcmd(Settings::Get('dkim.dkimrestart_command')));
|
||||
fwrite($this->debugHandler, ' cron_tasks: Task4 - Dkim-milter reloaded' . "\n");
|
||||
$this->logger->logAction(CRON_ACTION, LOG_INFO, 'Dkim-milter reloaded');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user