Skip to content

Commit 7416d2f

Browse files
author
A. Täffner
committed
finished new query style
improved crojob
1 parent 6e91b6f commit 7416d2f

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

server/lib/classes/cron.d/550-bind_dnssec.inc.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,13 @@ public function onRunJob() {
6868

6969
//TODO : change this when distribution information has been integrated into server record
7070
$filespre = (file_exists('/etc/gentoo-release')) ? 'pri/' : 'pri.';
71-
echo "signing for ".intval($conf['server_id'])."\n";
72-
$soas = $app->db->queryAllRecords('SELECT id,serial,origin FROM dns_soa WHERE server_id=? AND active=\'Y\' dnssec_wanted=\'Y\' AND dnssec_initialized=\'Y\' AND (dnssec_last_signed < ? OR dnssec_last_signed > ?)', intval($conf['server_id']), time()-(3600*24*5)+900, time()+900); //Resign zones every 5 days (expiry is 16 days so we have enough safety, 15 minutes tolerance)
71+
$soas = $app->db->queryAllRecords('SELECT `id`,`serial`,`origin` FROM dns_soa WHERE server_id=? AND active=\'Y\' AND dnssec_wanted=\'Y\' AND dnssec_initialized=\'Y\' AND (dnssec_last_signed < ? OR dnssec_last_signed > ?)', intval($conf['server_id']), time()-(3600*24*5)+900, time()+900); //Resign zones every 5 days (expiry is 16 days so we have enough safety, 15 minutes tolerance)
7372

7473
foreach ($soas as $data) {
75-
echo "Processing ".$data['origin']."\n";
7674
$domain = substr($data['origin'], 0, strlen($data['origin'])-1);
77-
if (!file_exists($dns_config['bind_zonefiles_dir'].'/'.$filespre.$domain)) return false;
75+
if (!file_exists($dns_config['bind_zonefiles_dir'].'/'.$filespre.$domain)) continue;
7876

79-
$app->log('DNSSEC Auto-Resign: Touching zone '.$domain, LOGLEVEL_INFO);
77+
$app->log('DNSSEC Auto-Resign: Touching zone '.$domain, LOGLEVEL_DEBUG);
8078
$app->db->datalogUpdate('dns_soa', array("serial" => $this->increase_serial($data['serial'])), 'id', $data['id']);
8179
}
8280

server/plugins-available/bind_plugin.inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ function soa_update($event_name, $data) {
244244
$zone = $data['new'];
245245
$tpl->setVar($zone);
246246

247-
$records = $app->db->queryAllRecords("SELECT * FROM dns_rr WHERE zone = ?? AND active = 'Y'", $zone['id']);
247+
$records = $app->db->queryAllRecords("SELECT * FROM dns_rr WHERE zone = ? AND active = 'Y'", $zone['id']);
248248
if(is_array($records) && !empty($records)){
249249
for($i=0;$i<sizeof($records);$i++){
250250
if($records[$i]['ttl'] == 0) $records[$i]['ttl'] = '';

0 commit comments

Comments
 (0)