[Svn] r4845 - trunk/roundcubemail/program/include

trac at roundcube.net trac at roundcube.net
Fri Jun 10 03:34:34 CEST 2011


Author: thomasb
Date: 2011-06-09 20:34:34 -0500 (Thu, 09 Jun 2011)
New Revision: 4845

Modified:
   trunk/roundcubemail/program/include/rcube_ldap.php
Log:
Only select dn for count queries

Modified: trunk/roundcubemail/program/include/rcube_ldap.php
===================================================================
--- trunk/roundcubemail/program/include/rcube_ldap.php	2011-06-09 19:43:22 UTC (rev 4844)
+++ trunk/roundcubemail/program/include/rcube_ldap.php	2011-06-10 01:34:34 UTC (rev 4845)
@@ -860,7 +860,7 @@
     *
     * @access private
     */
-    private function _exec_search($all = false)
+    private function _exec_search($count = false)
     {
         if ($this->ready)
         {
@@ -870,14 +870,16 @@
             $this->_debug("C: Search [".$filter."]");
 
             // when using VLV, we need to issue listing command first in order to get the full count
-            if (!$all && $function != 'ldap_read' && $this->prop['vlv']) {
-                $this->_exec_search(true);
-                $this->vlv_count = ldap_count_entries($this->conn, $this->ldap_result);
+            if (!$count && $function != 'ldap_read' && $this->prop['vlv']) {
+                if ($this->_exec_search(true))
+                    $this->vlv_count = ldap_count_entries($this->conn, $this->ldap_result);
                 $this->vlv_active = $this->_vlv_set_controls();
             }
 
+            // only fetch dn for count (should keep the payload low)
+            $attrs = $count ? array('dn') : array_values($this->fieldmap);
             if ($this->ldap_result = @$function($this->conn, $this->base_dn, $filter,
-                array_values($this->fieldmap), 0, (int) $this->prop['sizelimit'], (int) $this->prop['timelimit']))
+                $attrs, 0, (int)$this->prop['sizelimit'], (int)$this->prop['timelimit']))
             {
                 $this->_debug("S: ".ldap_count_entries($this->conn, $this->ldap_result)." record(s)");
                 return true;

_______________________________________________
http://lists.roundcube.net/mailman/listinfo/svn



More information about the Svn mailing list