From: hickert Date: Tue, 15 May 2007 09:38:49 +0000 (+0000) Subject: Added logging to some classes X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=a8938053e0351e7809469d96cb77d84b5ee8dff2;p=gosa.git Added logging to some classes git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@6384 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/plugins/admin/systems/class_phoneGeneric.inc b/plugins/admin/systems/class_phoneGeneric.inc index 928b7e317..5f2fd4220 100644 --- a/plugins/admin/systems/class_phoneGeneric.inc +++ b/plugins/admin/systems/class_phoneGeneric.inc @@ -92,6 +92,10 @@ class phoneGeneric extends plugin /* Save dn for later references */ $this->orig_dn= $this->dn; + + if($this->is_account){ + @log::log("view","phone/".get_class($this),$this->dn); + } } function set_acl_base($base) @@ -266,6 +270,9 @@ class phoneGeneric extends plugin $this->netConfigDNS->remove_from_parent(); $ldap->rmdir($this->dn); + + @log::log("remove","phone/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + show_ldap_error($ldap->get_error(), sprintf(_("Removing of system phone/generic with dn '%s' failed."),$this->dn)); $this->handle_post_events("remove"); @@ -392,6 +399,7 @@ class phoneGeneric extends plugin $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn)); $ldap->cd($this->dn); $ldap->add($this->attrs); + @log::log("create","phone/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); $this->handle_post_events("add"); } else { if ($this->orig_dn != $this->dn){ @@ -401,6 +409,7 @@ class phoneGeneric extends plugin $ldap->cd($this->dn); $this->cleanup(); $ldap->modify ($this->attrs); + @log::log("modify","phone/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); // $user_phone_reload $ldap->cd ($this->config->current['BASE']); diff --git a/plugins/admin/systems/class_printGeneric.inc b/plugins/admin/systems/class_printGeneric.inc index 68adab458..9000b008b 100644 --- a/plugins/admin/systems/class_printGeneric.inc +++ b/plugins/admin/systems/class_printGeneric.inc @@ -151,6 +151,10 @@ class printgeneric extends plugin } } } + + if($this->is_account){ + @log::log("view","printer/".get_class($this),$this->dn); + } } function set_acl_base($base) @@ -587,6 +591,9 @@ class printgeneric extends plugin /* Remove account & dns extension */ $this->netConfigDNS->remove_from_parent(); $ldap->rmdir($this->dn); + + @log::log("remove","printer/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + show_ldap_error($ldap->get_error(), sprintf(_("Removing of system print/generic with dn '%s' failed."),$this->dn)); $this->handle_post_events("remove"); @@ -823,11 +830,13 @@ class printgeneric extends plugin $ldap->add($this->attrs); $this->handle_post_events("add"); + @log::log("create","printer/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); } else { $ldap->cd($this->dn); $this->cleanup(); $ldap->modify ($this->attrs); $this->handle_post_events("modify"); + @log::log("modify","printer/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); } show_ldap_error($ldap->get_error(), sprintf(_("Saving of system print/generic with dn '%s' failed."),$this->dn)); diff --git a/plugins/admin/systems/class_servDHCP.inc b/plugins/admin/systems/class_servDHCP.inc index f841affd6..7796dc720 100644 --- a/plugins/admin/systems/class_servDHCP.inc +++ b/plugins/admin/systems/class_servDHCP.inc @@ -15,6 +15,10 @@ class servdhcp extends plugin function servdhcp ($config, $dn= NULL, $parent= NULL) { plugin::plugin ($config, $dn, $parent); + + if($this->is_account){ + @log::log("view","unknown/".get_class($this),$this->dn); + } } function execute() @@ -48,6 +52,7 @@ class servdhcp extends plugin function remove_from_parent() { /* This cannot be removed... */ + @log::log("remove","unknown/".get_class($this),$this->dn); } @@ -72,6 +77,7 @@ class servdhcp extends plugin function save() { plugin::save(); + @log::log("modfiy","unknown/".get_class($this),$this->dn); /* Optionally execute a command after we're done */ #$this->handle_post_events($mode); diff --git a/plugins/admin/systems/class_servDNS.inc b/plugins/admin/systems/class_servDNS.inc index 793acb21d..c32ac192d 100644 --- a/plugins/admin/systems/class_servDNS.inc +++ b/plugins/admin/systems/class_servDNS.inc @@ -50,6 +50,11 @@ class servdns extends goService }else{ $this->is_account = true; } + + if($this->is_account){ + @log::log("view","unknown/".get_class($this),$this->dn); + } + $this->initially_was_account = $this->is_account; } @@ -294,6 +299,7 @@ class servdns extends goService foreach($tmp['zoneUpdates'] as $dn => $attrs){ $ldap->cd($dn); $ldap->modify($attrs); + @log::log("modfiy","unknown/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); show_ldap_error($ldap->get_error(), sprintf(_("Updating of system server/dns with dn '%s' failed."),$this->dn)); } } @@ -303,6 +309,7 @@ class servdns extends goService foreach($tmp['del'] as $dn => $del){ $ldap->cd($dn); $ldap->rmdir_recursive($dn); + @log::log("remove","unknown/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); show_ldap_error($ldap->get_error(), sprintf(_("Removing of system server/dns with dn '%s' failed."),$this->dn)); } diff --git a/plugins/admin/systems/class_servGeneric.inc b/plugins/admin/systems/class_servGeneric.inc index be0ae77af..691853b4b 100644 --- a/plugins/admin/systems/class_servGeneric.inc +++ b/plugins/admin/systems/class_servGeneric.inc @@ -64,7 +64,11 @@ class servgeneric extends plugin $this->netConfigDNS = new termDNS($this->config,$this->dn,$this->objectclasses); $this->netConfigDNS->set_acl_category("server"); $this->netConfigDNS->set_acl_base($this->base); - + + if($this->is_account){ + @log::log("view","server/".get_class($this),$this->dn); + } + /* Save dn for later references */ $this->orig_dn= $this->dn; } @@ -233,6 +237,9 @@ class servgeneric extends plugin $this->netConfigDNS->remove_from_parent(); $ldap= $this->config->get_ldap_link(); $ldap->rmdir($this->dn); + + @log::log("remove","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + show_ldap_error($ldap->get_error(), sprintf(_("Removing of system server/generic with dn '%s' failed."),$this->dn)); /* Delete references to object groups */ @@ -325,6 +332,7 @@ class servgeneric extends plugin $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn)); $ldap->cd($this->dn); $ldap->add($this->attrs); + @log::log("create","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); $mode= "add"; } else { @@ -344,6 +352,7 @@ class servgeneric extends plugin $ldap->cd($this->dn); $this->cleanup(); $ldap->modify ($this->attrs); + @log::log("modify","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); $mode= "modify"; } diff --git a/plugins/admin/systems/class_servKolab.inc b/plugins/admin/systems/class_servKolab.inc index 5c036d196..3b666fd43 100644 --- a/plugins/admin/systems/class_servKolab.inc +++ b/plugins/admin/systems/class_servKolab.inc @@ -77,6 +77,9 @@ class servkolab extends goService { } } + if($this->is_account){ + @log::log("view","server/".get_class($this),$this->dn); + } } @@ -212,6 +215,8 @@ class servkolab extends goService { gosa_log("Removing ".$this->hostname." from list of kolabHosts"); } + @log::log("remove","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + /* Optionally execute a command after we're done */ $this->handle_post_events("remove"); } @@ -345,6 +350,13 @@ class servkolab extends goService { $ldap->cd($this->dn); $this->cleanup();; $ldap->$mode($this->attrs); + + if($mode == "add"){ + @log::log("create","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + }else{ + @log::log("modify","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + } + show_ldap_error($ldap->get_error(), sprintf(_("Saving system server/kolab with dn '%s' failed."),$this->dn)); /* Optionally execute a command after we're done */ diff --git a/plugins/admin/systems/class_servRepository.inc b/plugins/admin/systems/class_servRepository.inc index c84d4976c..740fdf0ea 100644 --- a/plugins/admin/systems/class_servRepository.inc +++ b/plugins/admin/systems/class_servRepository.inc @@ -83,6 +83,10 @@ class servrepository extends goService $this->repositories[$tmp[2]]=$tmp2; } } + + if($this->is_account){ + @log::log("view","server/".get_class($this),$this->dn); + } } function execute() @@ -346,6 +350,12 @@ class servrepository extends goService $ldap->add($this->attrs); $this->handle_post_events("add"); } + + if($this->initially_was_account){ + @log::log("modify","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + }else{ + @log::log("create","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + } } diff --git a/plugins/admin/systems/class_termDNS.inc b/plugins/admin/systems/class_termDNS.inc index cb678cbcc..1161e598b 100644 --- a/plugins/admin/systems/class_termDNS.inc +++ b/plugins/admin/systems/class_termDNS.inc @@ -95,6 +95,10 @@ class termDNS extends plugin /* Store initally account settings */ $this->initially_was_account = $this->DNS_is_account; + + if($this->DNS_is_account){ + @log::log("view","unknown/".get_class($this),$this->dn); + } } @@ -268,6 +272,7 @@ class termDNS extends plugin $ldap->cd($dn); $ldap->rmdir_recursive($dn); } + @log::log("remove","unknown/".get_class($this),$dn); } } @@ -481,6 +486,8 @@ class termDNS extends plugin } } + @log::log("modify","unknown/".get_class($this),$dn,array_keys($attrs),$ldap->get_error()); + /* Display errors */ if($ldap->get_error() != "Success"){ diff --git a/plugins/admin/systems/class_terminalGeneric.inc b/plugins/admin/systems/class_terminalGeneric.inc index 0495e0bda..722347908 100644 --- a/plugins/admin/systems/class_terminalGeneric.inc +++ b/plugins/admin/systems/class_terminalGeneric.inc @@ -124,6 +124,10 @@ class termgeneric extends plugin } $this->orig_dn= $this->dn; + + if($this->is_account){ + @log::log("view","terminal/".get_class($this),$this->dn); + } } function set_acl_base($base) @@ -345,6 +349,9 @@ class termgeneric extends plugin if($ldap->count()){ $this->netConfigDNS->remove_from_parent(); $ldap->rmDir($this->dn); + + @log::log("remove","terminal/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + show_ldap_error($ldap->get_error(), sprintf(_("Removing of object system terminal/generic with dn '%s' failed."),$this->dn)); /* Optionally execute a command after we're done */ @@ -510,12 +517,13 @@ class termgeneric extends plugin unset($this->attrs['gotoNtpServer']); } $ldap->add($this->attrs); + @log::log("create","terminal/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); $this->handle_post_events("add"); } else { $ldap->cd($this->dn); $this->cleanup(); $ldap->modify ($this->attrs); - + @log::log("modify","terminal/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); $this->handle_post_events("modify"); } diff --git a/plugins/admin/systems/class_terminalService.inc b/plugins/admin/systems/class_terminalService.inc index ac449433a..20407b4f2 100644 --- a/plugins/admin/systems/class_terminalService.inc +++ b/plugins/admin/systems/class_terminalService.inc @@ -243,6 +243,8 @@ class termservice extends plugin $this->gotoXHsync = preg_replace("/\+/","-",$this->gotoXHsync); $this->gotoXVsync = preg_replace("/\+/","-",$this->gotoXVsync); } + + @log::log("view","terminal/".get_class($this),$this->dn); } function execute() @@ -346,6 +348,7 @@ class termservice extends plugin function remove_from_parent() { + @log::log("remove","terminal/".get_class($this),$this->dn,array_keys($this->attrs)); $this->handle_post_events("remove"); } @@ -453,6 +456,7 @@ class termservice extends plugin $ldap->cd($this->dn); $this->cleanup(); $ldap->modify ($this->attrs); + @log::log("modify","terminal/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); show_ldap_error($ldap->get_error(), sprintf(_("Saving of object system terminal/service with dn '%s' failed."),$this->dn)); $this->handle_post_events("modify"); diff --git a/plugins/admin/systems/class_terminalStartup.inc b/plugins/admin/systems/class_terminalStartup.inc index d84b8c229..554118db4 100644 --- a/plugins/admin/systems/class_terminalStartup.inc +++ b/plugins/admin/systems/class_terminalStartup.inc @@ -144,6 +144,7 @@ class termstartup extends plugin } } } + @log::log("view","terminal/".get_class($this),$this->dn); } function execute() @@ -289,6 +290,7 @@ class termstartup extends plugin { if($this->acl_is_removeable()){ $this->handle_post_events("remove"); + @log::log("remove","terminal/".get_class($this),$this->dn,array_keys($this->attrs)); } } @@ -398,6 +400,8 @@ class termstartup extends plugin $this->cleanup(); $ldap->modify ($this->attrs); + @log::log("modify","terminal/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + show_ldap_error($ldap->get_error(), sprintf(_("Saving of system terminal/startup with dn '%s' failed."),$this->dn)); $this->handle_post_events("modify"); } diff --git a/plugins/admin/systems/class_winGeneric.inc b/plugins/admin/systems/class_winGeneric.inc index b7f0eb765..fef7254f8 100644 --- a/plugins/admin/systems/class_winGeneric.inc +++ b/plugins/admin/systems/class_winGeneric.inc @@ -62,6 +62,10 @@ class wingeneric extends plugin $this->orig_dn= $this->dn; $this->cn= preg_replace("/\\\$\$/","",$this->cn); + + if($this->is_account){ + @log::log("view","winworkstation/".get_class($this),$this->dn); + } } @@ -144,6 +148,7 @@ class wingeneric extends plugin $this->netConfigDNS->remove_from_parent(); $ldap= $this->config->get_ldap_link(); $ldap->rmdir($this->dn); + @log::log("remove","winworkstation/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); show_ldap_error($ldap->get_error(), sprintf(_("Removing of system wingeneric/generic with dn '%s' failed."),$this->dn)); $this->handle_post_events("remove"); @@ -243,6 +248,7 @@ class wingeneric extends plugin $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn)); $ldap->cd($this->dn); $ldap->add($this->attrs); + @log::log("create","winworkstation/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); $this->handle_post_events("add"); } else { if ($this->orig_dn != $this->dn){ @@ -252,7 +258,7 @@ class wingeneric extends plugin $ldap->cd($this->dn); $this->cleanup(); $ldap->modify ($this->attrs); - + @log::log("modify","winworkstation/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); $this->handle_post_events("modify"); } diff --git a/plugins/admin/systems/class_workstationGeneric.inc b/plugins/admin/systems/class_workstationGeneric.inc index f26f4a445..87eba977e 100644 --- a/plugins/admin/systems/class_workstationGeneric.inc +++ b/plugins/admin/systems/class_workstationGeneric.inc @@ -127,6 +127,10 @@ class workgeneric extends plugin $this->gotoSyslogServers[$server] = $visible; } + if($this->is_account){ + @log::log("view","workstation/".get_class($this),$this->dn); + } + /* Save 'dn' for later referal */ $this->orig_dn= $this->dn; } @@ -332,6 +336,7 @@ class workgeneric extends plugin $this->netConfigDNS->remove_from_parent(); $ldap= $this->config->get_ldap_link(); $ldap->rmdir($this->dn); + @log::log("remove","workstation/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); show_ldap_error($ldap->get_error(), sprintf(_("Removing of system workstation/generic with dn '%s' failed."),$this->dn)); /* Optionally execute a command after we're done */ @@ -491,6 +496,7 @@ class workgeneric extends plugin $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn)); $ldap->cd($this->dn); $ldap->add($this->attrs); + @log::log("create","workstation/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); show_ldap_error($ldap->get_error(), sprintf(_("Saving of system workstation/generic with dn '%s' failed."),$this->dn)); if(!$this->didAction){ $this->handle_post_events("add"); @@ -502,6 +508,7 @@ class workgeneric extends plugin $ldap->cd($this->dn); $this->cleanup(); $ldap->modify ($this->attrs); + @log::log("modify","workstation/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); if(!$this->didAction){ $this->handle_post_events("modify"); diff --git a/plugins/admin/systems/class_workstationService.inc b/plugins/admin/systems/class_workstationService.inc index a5fae17b8..51a0cab01 100644 --- a/plugins/admin/systems/class_workstationService.inc +++ b/plugins/admin/systems/class_workstationService.inc @@ -234,6 +234,8 @@ class workservice extends plugin $this->MouseTypes= array('AUTO' => _("inherited")); $this->MousePorts= array('AUTO' => _("inherited")); } + + @log::log("view","workstation/".get_class($this),$this->dn); } function execute() @@ -344,6 +346,7 @@ class workservice extends plugin function remove_from_parent() { $this->handle_post_events("remove"); + @log::log("remove","workstation/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); } /* Save data to object */ @@ -440,6 +443,7 @@ class workservice extends plugin $ldap->cd($this->dn); $this->cleanup(); $ldap->modify ($this->attrs); + @log::log("modify","workstation/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); show_ldap_error($ldap->get_error(), sprintf(_("Saving of system workstation/service with dn '%s' failed."),$this->dn)); $this->handle_post_events("modify"); } diff --git a/plugins/admin/systems/class_workstationStartup.inc b/plugins/admin/systems/class_workstationStartup.inc index 3c5875527..dc8aebdc3 100644 --- a/plugins/admin/systems/class_workstationStartup.inc +++ b/plugins/admin/systems/class_workstationStartup.inc @@ -367,6 +367,8 @@ class workstartup extends plugin if (!isset($this->gotoBootKernels['default-inherited']) && $this->gotoBootKernel == "default-inherited"){ $this->gotoBootKernel= "default"; } + + @log::log("view","workstation/".get_class($this),$this->dn); } @@ -805,6 +807,7 @@ class workstartup extends plugin function remove_from_parent() { $this->handle_post_events("remove"); + @log::log("remove","workstation/".get_class($this),$this->dn); } function generateDNSyn($release) @@ -1086,6 +1089,7 @@ class workstartup extends plugin $this->cleanup(); $ldap->modify ($this->attrs); + @log::log("modify","workstation/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); show_ldap_error($ldap->get_error(), sprintf(_("Saving of system workstation/startup with dn '%s' failed."),$this->dn)); $this->handle_post_events("modify");