summaryrefslogtreecommitdiff
path: root/program/include
diff options
context:
space:
mode:
authorthomascube <thomas@roundcube.net>2011-06-10 01:34:34 +0000
committerthomascube <thomas@roundcube.net>2011-06-10 01:34:34 +0000
commitc1db483cd5578704ffc49ec98686c0e061db9c50 (patch)
treefbd8fd83226f7bda31a7a023638ef82f57d4c03a /program/include
parent69ea3a342999b27a8cffb93b640390c09cb647bf (diff)
Only select dn for count queries
Diffstat (limited to 'program/include')
-rw-r--r--program/include/rcube_ldap.php12
1 files changed, 7 insertions, 5 deletions
diff --git a/program/include/rcube_ldap.php b/program/include/rcube_ldap.php
index e4c3d498f..6cab6dbc9 100644
--- a/program/include/rcube_ldap.php
+++ b/program/include/rcube_ldap.php
@@ -860,7 +860,7 @@ class rcube_ldap extends rcube_addressbook
*
* @access private
*/
- private function _exec_search($all = false)
+ private function _exec_search($count = false)
{
if ($this->ready)
{
@@ -870,14 +870,16 @@ class rcube_ldap extends rcube_addressbook
$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;