Code

Added logging to some classes
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 15 May 2007 09:38:49 +0000 (09:38 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 15 May 2007 09:38:49 +0000 (09:38 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@6384 594d385d-05f5-0310-b6e9-bd551577e9d8

15 files changed:
plugins/admin/systems/class_phoneGeneric.inc
plugins/admin/systems/class_printGeneric.inc
plugins/admin/systems/class_servDHCP.inc
plugins/admin/systems/class_servDNS.inc
plugins/admin/systems/class_servGeneric.inc
plugins/admin/systems/class_servKolab.inc
plugins/admin/systems/class_servRepository.inc
plugins/admin/systems/class_termDNS.inc
plugins/admin/systems/class_terminalGeneric.inc
plugins/admin/systems/class_terminalService.inc
plugins/admin/systems/class_terminalStartup.inc
plugins/admin/systems/class_winGeneric.inc
plugins/admin/systems/class_workstationGeneric.inc
plugins/admin/systems/class_workstationService.inc
plugins/admin/systems/class_workstationStartup.inc

index 928b7e317ee5aae18aa5fac9d80ea0e8a4008e96..5f2fd42200ae5aea5e88cc0fa8a7dd79069ae8a8 100644 (file)
@@ -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']); 
index 68adab4586198816ed18833671a4a71ef16bff59..9000b008bebf3a644e6f6a9fff24d2bc915f51b3 100644 (file)
@@ -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));
 
index f841affd653cd372ca09f8967b4944c43d0de81d..7796dc7201e2af683643bf61d076254635788d12 100644 (file)
@@ -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);
index 793acb21dafd672009cf25998d00fe90af6f7d63..c32ac192d20f3fa87a1867d16f2f6005d8779e8f 100644 (file)
@@ -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));
     }
 
index be0ae77afc5c4fc36772cff54f3ea0c5320704d5..691853b4b2f3628ed3ee0b9bc09bbb9462d77cc4 100644 (file)
@@ -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";
     }
index 5c036d1965b74e0191bd0ca2d0b0bb5636bc9343..3b666fd43bbae9848f4ebb8cfcc630909d4d4c81 100644 (file)
@@ -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 */
index c84d4976cbcc87837e4ed55f8b1dbe28f689f7d6..740fdf0ea6a668b85825bcf73751db54c7b6ee25 100644 (file)
@@ -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());
+    }
   }
 
 
index cb678cbccdff2900cf757a87e80b5298bd66a738..1161e598b84d476ec2bba219c4e91941d42b438a 100644 (file)
@@ -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"){
index 0495e0bda05e9b6389971045a8efa60eb1426df2..7223479082be051868eaf1822669d6d09bde6577 100644 (file)
@@ -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");
     }
     
index ac449433ab44c1dda0079afdd82586cfed8e1011..20407b4f24f7050e05f1e7cc098a39ac67e396e9 100644 (file)
@@ -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");
index d84b8c229b2de249f989d8a128ec4b3681173574..554118db406ba56482a279773e267e79bff3faec 100644 (file)
@@ -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");
   }
index b7f0eb76502c0b4bde04f8180f682b9b7db622f0..fef7254f884fe0089f0e5b1a02255c339ec94fd5 100644 (file)
@@ -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");
     }
 
index f26f4a44582aa2345481d7ca7b0d24dc74d046f5..87eba977e0ac9c1b17e2d922a509ff548ad2fd78 100644 (file)
@@ -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");
index a5fae17b8bbdd799c21d40206f7d5e59daa484f4..51a0cab019b13104c0ca74f8f26f4830d769f099 100644 (file)
@@ -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");
   }
index 3c587552768ecf594a36000acaafaf6775eed7c2..dc8aebdc3bcb533b342f1c0387041455c335ef12 100644 (file)
@@ -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");