From c13535a72f20e59aa2a59faa047492ccb3f873bd Mon Sep 17 00:00:00 2001 From: tbrehm Date: Tue, 11 Aug 2009 10:57:28 +0000 Subject: [PATCH] Added DNS server module. --- server/mods-available/dns_module.inc.php | 105 +++++++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 server/mods-available/dns_module.inc.php diff --git a/server/mods-available/dns_module.inc.php b/server/mods-available/dns_module.inc.php new file mode 100644 index 0000000000..79b0e5b5a3 --- /dev/null +++ b/server/mods-available/dns_module.inc.php @@ -0,0 +1,105 @@ +plugins->announceEvents($this->module_name,$this->actions_available); + + /* + As we want to get notified of any changes on several database tables, + we register for them. + + The following function registers the function "functionname" + to be executed when a record for the table "dbtable" is + processed in the sys_datalog. "classname" is the name of the + class that contains the function functionname. + */ + + $app->modules->registerTableHook('dns_soa',$this->module_name,'process'); + $app->modules->registerTableHook('dns_rr',$this->module_name,'process'); + + } + + /* + This function is called when a change in one of the registered tables is detected. + The function then raises the events for the plugins. + */ + + function process($tablename,$action,$data) { + global $app; + + switch ($tablename) { + case 'dns_soa': + if($action == 'i') $app->plugins->raiseEvent('dns_soa_insert',$data); + if($action == 'u') $app->plugins->raiseEvent('dns_soa_update',$data); + if($action == 'd') $app->plugins->raiseEvent('dns_soa_delete',$data); + break; + case 'dns_rr': + if($action == 'i') $app->plugins->raiseEvent('dns_rr_insert',$data); + if($action == 'u') $app->plugins->raiseEvent('dns_rr_update',$data); + if($action == 'd') $app->plugins->raiseEvent('dns_rr_delete',$data); + break; + } // end switch + } // end function + + +} // end class + +?> \ No newline at end of file -- GitLab