Code

Updated ldap->search for speed improvements
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 12 Jan 2006 15:27:59 +0000 (15:27 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 12 Jan 2006 15:27:59 +0000 (15:27 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2470 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/addons/addressbook/class_addressbook.inc
plugins/admin/systems/class_workstationGeneric.inc
plugins/generic/references/class_reference.inc
plugins/gofax/blocklists/class_blocklistManagement.inc
plugins/personal/connectivity/class_kolabAccount.inc
plugins/personal/environment/class_hotplugDialog.inc
plugins/personal/mail/class_mailAccount.inc
plugins/personal/samba/class_sambaAccount.inc

index 4ffa68c758c149bdf7e67735aad3c857d35b81b9..225631cf57db1832879c7f6a8daa6558716722ea 100644 (file)
@@ -316,11 +316,11 @@ class addressbook extends plugin
                foreach ($bases as $base){
                        $ldap->cd ($base);
                        if ($phonefilter['object_type'] == '*'){
-                               $ldap->search ("(&(objectClass=person)$filter(!(objectClass=gosaUserTemplate))(!(uid=*$))".
+                               $ldap->search ("(&(objectClass=person)$filter(!(objectClass=gosaUserTemplate))(!(uid=*$))". //array
                                                "(|(uid=$s)(homePhone=$s)(telephoneNumber=$s)".
                                                "(facsimileTelephoneNumber=$s)(mobile=$s)(givenName=$s)(sn=$s)))", array("sn", "givenName", "telephoneNumber", "facsimileTelephoneNumber", "mobile", "homePhone", "uid", "mail", "cn"));
                        } else {
-                               $ldap->search ("(&$filter(!(uid=*$))(!(objectClass=gosaUserTemplate))".
+                               $ldap->search ("(&$filter(!(uid=*$))(!(objectClass=gosaUserTemplate))".                     //array
                                                "(".$phonefilter['object_type']."=$s))", array("sn", "givenName", "telephoneNumber", "facsimileTelephoneNumber", "mobile", "homePhone", "uid", "mail", "cn"));
                        }
 
index 6ee0d68f5712f2030eabdc3a0bd01cbc73ee9746..eb4f05fbafe41f869ad24f2b0ad5b00d824555b4 100644 (file)
@@ -52,7 +52,7 @@ class workgeneric extends plugin
     /* Load available modes */
     $ldap= $this->config->get_ldap_link();
     $ldap->cd ($this->config->current['BASE']);
-    $ldap->search ("(objectClass=gotoInstallProfile)");
+    $ldap->search ("(objectClass=gotoInstallProfile)",array("cn"));
     while ($attrs= $ldap->fetch()){
       $this->modes[]= $attrs["cn"][0];
     }
index 70a4f6b69125617b71f4b82bd8d22c14b2031f31..43d945dbeb41c00b70c0929018b7f1cb0f87561b 100644 (file)
@@ -82,7 +82,7 @@ class reference extends plugin
   {
        $ldap= $this->config->get_ldap_link();
        $ldap->cd($this->config->current['BASE']);
-       $ldap->search("(|(member=".$this->dn.")(memberUid=".$this->uid."))");
+       $ldap->search("(|(member=".$this->dn.")(memberUid=".$this->uid."))",array("memberUid","member","cn","description","objectClass"));
        
        $cycle= array("F5F5F5", "ECECEC");
        $id= 0;
index 10f05354159ce9a0316d0b6103091b016d32f8ef..5f6025c4b4712941c47ae81ef223ffefa4772e2b 100644 (file)
@@ -533,8 +533,7 @@ class blocklist extends plugin
       if ($this->dn == 'new'){
         $ldap= $this->config->get_ldap_link();
         $ldap->cd ("ou=gofax,ou=systems,".$this->config->current["BASE"]);
-        $ldap->search ("(&(|(objectClass=goFaxSBlock)(objectClass=goFaxRBlock))".
-            "(cn=".$this->cn."))", array("cn"));
+        $ldap->search ("(&(|(objectClass=goFaxSBlock)(objectClass=goFaxRBlock))(cn=".$this->cn."))", array("cn"));
         if ($ldap->count() != 0){
           $message[]= _("Specified name is already used.");
         }
@@ -571,7 +570,7 @@ class blocklist extends plugin
     /* Write back to ldap */
     $ldap= $this->config->get_ldap_link();
     $ldap->cd($ldap->getParentDir($this->dn));
-    $ldap->search("cn=$this->cn");
+    $ldap->search("cn=$this->cn",array("cn"));
     $a= $ldap->fetch();
     if (count($a)){
       if (!isset($this->attrs["$type"."list"])){
index 7949f03246c802700563c69a9306266294156d7e..7596ec118580cf4af6382610259cec1b9a9a6f1e 100644 (file)
@@ -108,7 +108,7 @@ class kolabAccount extends plugin
 
           $ldap= $this->config->get_ldap_link();
           $ldap->cd ($this->config->current['BASE']);
-          $ldap->search('(mail='.$address.')');
+          $ldap->search('(mail='.$address.')',array("mail"));
           if ($ldap->count() == 0){
             print_red (_("The mail address you're trying to add is no primary mail address of an existing user."));
           } else {
@@ -254,7 +254,7 @@ class kolabAccount extends plugin
 
         $ldap= $this->config->get_ldap_link();
         $ldap->cd ($this->config->current['BASE']);
-        $ldap->search('(mail='.$address.')');
+        $ldap->search('(mail='.$address.')',array("mail"));
         if ($ldap->count() == 0){
           $message[]= sprintf(_("There's no mail user with address '%s' for your invitation policy!"), $address);
         } else {
index 22b11d98880c027770dc000a601b56d29f5678bf..dc9fbfdf2739f5b19ca399877a98aa32215a441d 100644 (file)
@@ -118,7 +118,7 @@ class hotplugDialog extends plugin
       }
 
     $ldap = $this->config->get_ldap_link();
-    $ldap->search("(&(objectClass=gotoEnvironment)(gotoHotplugDevice=".$this->HOT_name."*))");
+    $ldap->search("(&(objectClass=gotoEnvironment)(gotoHotplugDevice=".$this->HOT_name."*))",array("gotoHotplugDevice"));
     if($ldap->count()){
       $message[]=_("An Entry with this name already exists.");
     }
index 72c33376cf80c28d3c0c889591f5df4a40b06ee2..1f02e8c1e2eebe74b42d94001f7b242caccd32fb 100644 (file)
@@ -714,8 +714,7 @@ class mailAccount extends plugin
       }
     }
     $ldap->cd($this->config->current['BASE']);
-    $ldap->search ("(&(!(objectClass=gosaUserTemplate))(objectClass=gosaMailAccount)(|(mail=".$this->mail.")(gosaMailAlternateAddress=".
-        $this->mail."))(!(uid=".$this->uid."))(!(cn=".$this->uid.")))", array("uid"));
+    $ldap->search ("(&(!(objectClass=gosaUserTemplate))(objectClass=gosaMailAccount)(|(mail=".$this->mail.")(gosaMailAlternateAddress=".$this->mail."))(!(uid=".$this->uid."))(!(cn=".$this->uid.")))", array("uid"));
     if ($ldap->count() != 0){
       $message[]= _("The primary address you've entered is already in use.");
     }
@@ -802,8 +801,7 @@ class mailAccount extends plugin
 
     /* Is this address already assigned in LDAP? */
     $ldap->cd ($this->config->current['BASE']);
-    $ldap->search ("(&(objectClass=gosaMailAccount)(|(mail=$address)".
-        "(gosaMailAlternateAddress=$address)))", array("uid"));
+    $ldap->search ("(&(objectClass=gosaMailAccount)(|(mail=$address)"."(gosaMailAlternateAddress=$address)))", array("uid"));
 
     if ($ldap->count() > 0){
       $attrs= $ldap->fetch ();
index 0dc5545792ad720d38a21389ed9d074375513527..5a8cab0553bf96f3c0bcf3134501d9c24a8875b7 100644 (file)
@@ -118,7 +118,7 @@ class sambaAccount extends plugin
       $this->SID= preg_replace ("/-[^-]+$/", "", $this->sambaSID);
       $ldap= $this->config->get_ldap_link();
       $ldap->cd($this->config->current['BASE']);
-      $ldap->search ("(&(objectClass=sambaDomain)(sambaSID=$this->SID))");
+      $ldap->search ("(&(objectClass=sambaDomain)(sambaSID=$this->SID))",array("sambaAlgorithmicRidBase","sambaDomainName"));
       if ($ldap->count() != 0){
         $attrs= $ldap->fetch();
         $this->ridBase= $attrs['sambaAlgorithmicRidBase'][0];
@@ -860,8 +860,7 @@ class sambaAccount extends plugin
 
         /* Check for users primary group */
         $ldap->cd($this->config->current['BASE']);
-        $ldap->search("(&(objectClass=posixGroup)(gidNumber=".$this->gidNumber."))",
-                      array("cn"));
+        $ldap->search("(&(objectClass=posixGroup)(gidNumber=".$this->gidNumber."))", array("cn"));
         if ($ldap->count() != 1){
           print_red(_("Warning: Can't identify users primary group - no conversion to a samba group possible!"));
         } else {