Skip to content

Commit 0d83850

Browse files
committed
Revert "Avoid running checkzone for each rr when deleting a soa, #6647"
This reverts commit b571cfe. Too complex, alterative suggested
1 parent b571cfe commit 0d83850

File tree

3 files changed

+6
-13
lines changed

3 files changed

+6
-13
lines changed

interface/lib/classes/db_mysql.inc.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -686,7 +686,7 @@ public function getDatabaseSize($database_name) {
686686
}
687687

688688
//** Function to fill the datalog with a full differential record.
689-
public function datalogSave($db_table, $action, $primary_field, $primary_id, $record_old, $record_new, $force_update = false, $options = []) {
689+
public function datalogSave($db_table, $action, $primary_field, $primary_id, $record_old, $record_new, $force_update = false) {
690690
global $app;
691691

692692
// Insert backticks only for incomplete table names.
@@ -712,7 +712,6 @@ public function datalogSave($db_table, $action, $primary_field, $primary_id, $re
712712
$server_id = (isset($record_old['server_id']) && $record_old['server_id'] > 0)?$record_old['server_id']:0;
713713
if(isset($record_new['server_id'])) $server_id = $record_new['server_id'];
714714

715-
$diffrec_full['options'] = $options;
716715

717716
if($diff_num > 0) {
718717
$diffstr = serialize($diffrec_full);
@@ -811,7 +810,7 @@ public function datalogUpdate($tablename, $update_data, $index_field, $index_val
811810
}
812811

813812
//** Deletes a record and saves the changes into the datalog
814-
public function datalogDelete($tablename, $index_field, $index_value, $options = []) {
813+
public function datalogDelete($tablename, $index_field, $index_value) {
815814
global $app;
816815

817816
// Check fields
@@ -821,7 +820,7 @@ public function datalogDelete($tablename, $index_field, $index_value, $options =
821820
$old_rec = $this->queryOneRecord("SELECT * FROM ?? WHERE ?? = ?", $tablename, $index_field, $index_value);
822821
$this->query("DELETE FROM ?? WHERE ?? = ?", $tablename, $index_field, $index_value);
823822
$new_rec = array();
824-
$this->datalogSave($tablename, 'DELETE', $index_field, $index_value, $old_rec, $new_rec, FALSE, $options);
823+
$this->datalogSave($tablename, 'DELETE', $index_field, $index_value, $old_rec, $new_rec);
825824

826825
return true;
827826
}

interface/web/dns/dns_soa_del.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,10 @@ function onBeforeDelete() {
5555

5656
if($app->tform->checkPerm($this->id, 'd') == false) $app->error($app->lng('error_no_delete_permission'));
5757

58-
// Delete all records that belong to this zone.
58+
// Delete all records that belog to this zone.
5959
$records = $app->db->queryAllRecords("SELECT id FROM dns_rr WHERE zone = ?", $this->id);
60-
$options = ['deleting_dns_soa' => TRUE];
6160
foreach($records as $rec) {
62-
$app->db->datalogDelete('dns_rr', 'id', $rec['id'], $options);
61+
$app->db->datalogDelete('dns_rr', 'id', $rec['id']);
6362
}
6463
}
6564

server/plugins-available/bind_plugin.inc.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ function soa_update($event_name, $data) {
352352
$loglevel = @($dns_config['disable_bind_log'] === 'y') ? LOGLEVEL_DEBUG : LOGLEVEL_WARN;
353353
$app->log("Writing BIND domain file failed: ".$filename." ".implode(' ', $out), $loglevel);
354354
if(is_array($out) && !empty($out)){
355-
$app->log('Reason for Bind zone check failure: '.implode("\n", $out), $loglevel);
355+
$app->log('Reason for Bind restart failure: '.implode("\n", $out), $loglevel);
356356
$app->dbmaster->datalogError(implode("\n", $out));
357357
}
358358
if ($old_zonefile != '') {
@@ -524,11 +524,6 @@ function rr_update($event_name, $data) {
524524
function rr_delete($event_name, $data) {
525525
global $app, $conf;
526526

527-
if (!empty($data['options']['deleting_dns_soa']) && $data['options']['deleting_dns_soa'] == TRUE) {
528-
$app->log("Skipping zone update since it's alse being deleted", LOGLEVEL_DEBUG);
529-
return;
530-
}
531-
532527
//* Get the data of the soa and call soa_update
533528
$tmp = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = ?", $data['old']['zone']);
534529
$data["new"] = $tmp;

0 commit comments

Comments
 (0)