From: cajus Date: Thu, 14 Sep 2006 12:37:44 +0000 (+0000) Subject: Added more logging, and speed improvements X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=ebf30f2b847e223d905ec93a531966445915a960;p=gosa.git Added more logging, and speed improvements git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@4663 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/include/class_ldap.inc b/include/class_ldap.inc index 4f0fd2b45..6473bc74e 100644 --- a/include/class_ldap.inc +++ b/include/class_ldap.inc @@ -197,6 +197,8 @@ class LDAP{ } } + $this->log("LDAP operation: time=".get_MicroTimeDiff($start,microtime())." operation=search('".$this->fix($this->basedn)."', '$filter')"); + return($this->sr); }else{ $this->error = "Could not connect to LDAP server"; @@ -229,6 +231,8 @@ class LDAP{ } } + $this->log("LDAP operation: time=".get_MicroTimeDiff($start,microtime())." operation=ls('".$this->fix($basedn)."', '$filter')"); + return($this->sr); }else{ $this->error = "Could not connect to LDAP server"; @@ -240,12 +244,14 @@ class LDAP{ { if($this->hascon){ if ($this->reconnect) $this->connect(); + $start = microtime(); $this->clearResult(); $filter = "(objectclass=*)"; $this->sr = @ldap_read($this->cid, $this->fix($dn), $filter,$attrs); $this->error = @ldap_error($this->cid); $this->resetResult(); $this->hasres=true; + $this->log("LDAP operation: time=".get_MicroTimeDiff($start,microtime())." operation=cat('".$this->fix($dn)."')"); return($this->sr); }else{ $this->error = "Could not connect to LDAP server"; @@ -390,8 +396,10 @@ class LDAP{ { if($this->hascon){ if ($this->reconnect) $this->connect(); + $start= microtime(); $r = @ldap_delete($this->cid, $this->fix($deletedn)); $this->error = @ldap_error($this->cid); + $this->log("LDAP operation: time=".get_MicroTimeDiff($start,microtime())." operation=delete('".$this->fix($delettedn)."')"); return($r ? $r : 0); }else{ $this->error = "Could not connect to LDAP server"; @@ -621,8 +629,10 @@ class LDAP{ } if($this->hascon){ if ($this->reconnect) $this->connect(); + $start= microtime(); $r = @ldap_modify($this->cid, $this->fix($this->basedn), $attrs); $this->error = @ldap_error($this->cid); + $this->log("LDAP operation: time=".get_MicroTimeDiff($start,microtime())." operation=modify('$this->basedn')"); return($r ? $r : 0); }else{ $this->error = "Could not connect to LDAP server"; @@ -634,8 +644,10 @@ class LDAP{ { if($this->hascon){ if ($this->reconnect) $this->connect(); + $start= microtime(); $r = @ldap_add($this->cid, $this->fix($this->basedn), $attrs); $this->error = @ldap_error($this->cid); + $this->log("LDAP operation: time=".get_MicroTimeDiff($start,microtime())." operation=add('$this->basedn')"); return($r ? $r : 0); }else{ $this->error = "Could not connect to LDAP server"; @@ -1139,6 +1151,16 @@ function gen_xls ($dn, $filter= "(objectClass=*)", $attributes= array('*'), $rec return $objectclasses; } + + function log($string) + { + $cfg= $_SESSION['config']; + if (isset($cfg->current['LDAPSTATS']) && preg_match('/true/i', $cfg->current['LDAPSTATS'])){ + syslog (LOG_INFO, $string); + } + } + + } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: diff --git a/include/class_tabs.inc b/include/class_tabs.inc index e0e8dbe42..5c3204571 100644 --- a/include/class_tabs.inc +++ b/include/class_tabs.inc @@ -32,7 +32,7 @@ class tabs var $by_object= array(); var $SubDialog = false; - function tabs($config, $data, $dn) + function tabs($config, $data, $dn, $gui= true) { /* Save dn */ $this->dn= $dn; @@ -40,7 +40,11 @@ class tabs foreach ($data as $tab){ $this->by_name[$tab['CLASS']]= $tab['NAME']; - $this->by_object[$tab['CLASS']]= new $tab['CLASS']($this->config, $this->dn); + if ($gui){ + $this->by_object[$tab['CLASS']]= new $tab['CLASS']($this->config, $this->dn); + } else { + $this->by_object[$tab['CLASS']]= new $tab['CLASS']($this->config, $this->dn, false); + } $this->by_object[$tab['CLASS']]->parent= &$this; /* Initialize current */ diff --git a/plugins/admin/groups/tabs_group.inc b/plugins/admin/groups/tabs_group.inc index a4d0279db..8357a0e42 100644 --- a/plugins/admin/groups/tabs_group.inc +++ b/plugins/admin/groups/tabs_group.inc @@ -3,9 +3,9 @@ class grouptabs extends tabs { - function grouptabs($config, $data, $dn) + function grouptabs($config, $data, $dn, $gui= true) { - tabs::tabs($config, $data, $dn); + tabs::tabs($config, $data, $dn, $gui); $baseobject= $this->by_object['group']; foreach ($this->by_object as $name => $obj){ if(isset($obj->parent)){ diff --git a/plugins/personal/posix/class_posixAccount.inc b/plugins/personal/posix/class_posixAccount.inc index 46c2c299a..904a11c24 100644 --- a/plugins/personal/posix/class_posixAccount.inc +++ b/plugins/personal/posix/class_posixAccount.inc @@ -864,7 +864,7 @@ class posixAccount extends plugin /* Take care about groupMembership values: add to groups */ foreach ($this->groupMembership as $key => $value){ if (!isset($this->savedGroupMembership[$key])){ - $g= new grouptabs($this->config,$this->config->data['TABS']['GROUPTABS'], $key); + $g= new grouptabs($this->config,$this->config->data['TABS']['GROUPTABS'], $key, false); $g->by_object['group']->addUser($this->uid); $g->save(); }