Code

Added pChart classes and GOsa mapping class to enable auto-include
[gosa.git] / gosa-core / include / class_ldap.inc
index ba2dafe6db5e376595bf59764de6d1bcf6fcef87..bac40e5e07fd0a947cc96ca68801d06d1f1feb2b 100644 (file)
@@ -235,6 +235,10 @@ class LDAP{
       }
 
       $this->log("LDAP operation: time=".(microtime(true)-$start)." operation=search('".LDAP::fix($this->basedn)."', '$filter')");
+
+      // Create statistic table entry 
+      stats::log('ldap', $class = get_class($this), $category = array(),  $action = __FUNCTION__, 
+              $amount = 1, $duration = (microtime(TRUE) - $start));
       return($this->sr[$srp]);
     }else{
       $this->error = "Could not connect to LDAP server";
@@ -269,6 +273,10 @@ class LDAP{
 
       $this->log("LDAP operation: time=".(microtime(true) - $start)." operation=ls('".LDAP::fix($basedn)."', '$filter')");
 
+      // Create statistic table entry 
+      stats::log('ldap', $class = get_class($this), $category = array(),  $action = __FUNCTION__, 
+              $amount = 1, $duration = (microtime(TRUE) - $start));
+
       return($this->sr[$srp]);
     }else{
       $this->error = "Could not connect to LDAP server";
@@ -584,12 +592,17 @@ class LDAP{
       return (0);
     }
     if($this->hascon){
+      $start = microtime(TRUE);
       if ($this->reconnect) $this->connect();
       $r = @ldap_modify($this->cid, LDAP::fix($this->basedn), $attrs);
       $this->error = @ldap_error($this->cid);
       if(!$this->success()){
         $this->error.= $this->makeReadableErrors($this->error,$attrs);
       }
+
+      // Create statistic table entry 
+      stats::log('ldap', $class = get_class($this), $category = array(),  $action = __FUNCTION__, 
+              $amount = 1, $duration = (microtime(TRUE) - $start));
       return($r ? $r : 0);
     }else{
       $this->error = "Could not connect to LDAP server";
@@ -600,12 +613,18 @@ class LDAP{
   function add($attrs)
   {
     if($this->hascon){
+      $start = microtime(TRUE);
       if ($this->reconnect) $this->connect();
       $r = @ldap_add($this->cid, LDAP::fix($this->basedn), $attrs);
       $this->error = @ldap_error($this->cid);
       if(!$this->success()){
         $this->error.= $this->makeReadableErrors($this->error,$attrs);
       }
+
+      // Create statistic table entry 
+      stats::log('ldap', $class = get_class($this), $category = array(),  $action = __FUNCTION__, 
+              $amount = 1, $duration = (microtime(TRUE) - $start));
+
       return($r ? $r : 0);
     }else{
       $this->error = "Could not connect to LDAP server";