Skip to content
Snippets Groups Projects
Verified Commit 9f769b47 authored by Helmo's avatar Helmo
Browse files

make more uses of running_on_slaveserver

parent cf291119
No related branches found
No related tags found
1 merge request!1735Add a util function running_on_master() to improve code readablility
...@@ -189,7 +189,7 @@ class bind_plugin { ...@@ -189,7 +189,7 @@ class bind_plugin {
} }
} }
if (!$app->running_on_master()) $app->dbmaster->query('UPDATE dns_soa SET dnssec_info=?, dnssec_initialized=\'Y\', dnssec_last_signed=? WHERE id=?', $dnssecdata, intval(time()), intval($data['new']['id'])); if ($app->running_on_slaveserver()) $app->dbmaster->query('UPDATE dns_soa SET dnssec_info=?, dnssec_initialized=\'Y\', dnssec_last_signed=? WHERE id=?', $dnssecdata, intval(time()), intval($data['new']['id']));
$app->db->query('UPDATE dns_soa SET dnssec_info=?, dnssec_initialized=\'Y\', dnssec_last_signed=? WHERE id=?', $dnssecdata, intval(time()), intval($data['new']['id'])); $app->db->query('UPDATE dns_soa SET dnssec_info=?, dnssec_initialized=\'Y\', dnssec_last_signed=? WHERE id=?', $dnssecdata, intval(time()), intval($data['new']['id']));
} }
...@@ -244,7 +244,7 @@ class bind_plugin { ...@@ -244,7 +244,7 @@ class bind_plugin {
unlink($dns_config['bind_zonefiles_dir'].'/'.$dns_config['bind_zonefiles_masterprefix'].$domain.'.signed'); unlink($dns_config['bind_zonefiles_dir'].'/'.$dns_config['bind_zonefiles_masterprefix'].$domain.'.signed');
unlink($dns_config['bind_keyfiles_dir'].'/dsset-'.$domain.'.'); unlink($dns_config['bind_keyfiles_dir'].'/dsset-'.$domain.'.');
if (!$app->running_on_master()) $app->dbmaster->query('UPDATE dns_soa SET dnssec_info=\'\', dnssec_initialized=\'N\' WHERE id=?', intval($data['new']['id'])); if ($app->running_on_slaveserver()) $app->dbmaster->query('UPDATE dns_soa SET dnssec_info=\'\', dnssec_initialized=\'N\' WHERE id=?', intval($data['new']['id']));
$app->db->query('UPDATE dns_soa SET dnssec_info=\'\', dnssec_initialized=\'N\' WHERE id=?', intval($data['new']['id'])); $app->db->query('UPDATE dns_soa SET dnssec_info=\'\', dnssec_initialized=\'N\' WHERE id=?', intval($data['new']['id']));
} }
......
...@@ -546,7 +546,7 @@ class powerdns_plugin { ...@@ -546,7 +546,7 @@ class powerdns_plugin {
$dnssec_info = array_merge($this->format_dnssec_pubkeys($pubkeys), array('', '== Raw log ============================'), $log); $dnssec_info = array_merge($this->format_dnssec_pubkeys($pubkeys), array('', '== Raw log ============================'), $log);
$dnssec_info = implode("\r\n", $dnssec_info); $dnssec_info = implode("\r\n", $dnssec_info);
if (!$app->running_on_master()) { if ($app->running_on_slaveserver()) {
$app->dbmaster->query('UPDATE dns_soa SET dnssec_info=?, dnssec_initialized=? WHERE id=?', $dnssec_info, 'Y', intval($data['new']['id'])); $app->dbmaster->query('UPDATE dns_soa SET dnssec_info=?, dnssec_initialized=? WHERE id=?', $dnssec_info, 'Y', intval($data['new']['id']));
} }
$app->db->query('UPDATE dns_soa SET dnssec_info=?, dnssec_initialized=? WHERE id=?', $dnssec_info, 'Y', intval($data['new']['id'])); $app->db->query('UPDATE dns_soa SET dnssec_info=?, dnssec_initialized=? WHERE id=?', $dnssec_info, 'Y', intval($data['new']['id']));
...@@ -649,7 +649,7 @@ class powerdns_plugin { ...@@ -649,7 +649,7 @@ class powerdns_plugin {
$log[] = sprintf("\r\n%s %s", date('c'), 'Running disable-dnssec command...'); $log[] = sprintf("\r\n%s %s", date('c'), 'Running disable-dnssec command...');
exec($cmd_disable_dnssec, $log); exec($cmd_disable_dnssec, $log);
if (!$app->running_on_master()) { if ($app->running_on_slaveserver()) {
$app->dbmaster->query('UPDATE dns_soa SET dnssec_initialized=? WHERE id=?', 'N', intval($data['new']['id'])); $app->dbmaster->query('UPDATE dns_soa SET dnssec_initialized=? WHERE id=?', 'N', intval($data['new']['id']));
} }
$app->db->query('UPDATE dns_soa SET dnssec_initialized=? WHERE id=?', 'N', intval($data['new']['id'])); $app->db->query('UPDATE dns_soa SET dnssec_initialized=? WHERE id=?', 'N', intval($data['new']['id']));
...@@ -680,7 +680,7 @@ class powerdns_plugin { ...@@ -680,7 +680,7 @@ class powerdns_plugin {
$dnssec_info = array_merge(array('== Raw log ============================'), $log); $dnssec_info = array_merge(array('== Raw log ============================'), $log);
$dnssec_info = implode("\r\n", $dnssec_info); $dnssec_info = implode("\r\n", $dnssec_info);
if (!$app->running_on_master()) { if ($app->running_on_slaveserver()) {
$app->dbmaster->query('UPDATE dns_soa SET dnssec_info=?, dnssec_initialized=? WHERE id=?', $dnssec_info, 'N', intval($data['new']['id'])); $app->dbmaster->query('UPDATE dns_soa SET dnssec_info=?, dnssec_initialized=? WHERE id=?', $dnssec_info, 'N', intval($data['new']['id']));
} }
$app->db->query('UPDATE dns_soa SET dnssec_info=?, dnssec_initialized=? WHERE id=?', $dnssec_info, 'N', intval($data['new']['id'])); $app->db->query('UPDATE dns_soa SET dnssec_info=?, dnssec_initialized=? WHERE id=?', $dnssec_info, 'N', intval($data['new']['id']));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment