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

trac at roundcube.net trac at roundcube.net
Fri Jun 3 14:09:10 CEST 2011


Author: alec
Date: 2011-06-03 07:09:10 -0500 (Fri, 03 Jun 2011)
New Revision: 4835

Modified:
   trunk/roundcubemail/program/include/rcube_contacts.php
Log:
- Performance improvement, fix case-sensitivness in advanced search


Modified: trunk/roundcubemail/program/include/rcube_contacts.php
===================================================================
--- trunk/roundcubemail/program/include/rcube_contacts.php	2011-06-03 11:03:13 UTC (rev 4834)
+++ trunk/roundcubemail/program/include/rcube_contacts.php	2011-06-03 12:09:10 UTC (rev 4835)
@@ -284,7 +284,7 @@
                         $where[] = '(' . join(' AND ', $words) . ')';
                     }
                     if (is_array($value))
-                        $post_search[$col] = $strict ? $val : mb_strtolower($val);
+                        $post_search[$col] = mb_strtolower($val);
                 }
             }
         }
@@ -331,9 +331,8 @@
                             if (is_array($value)) {
                                 $value = implode($value);
                             }
-                            if (($strict && $value == $search)
-                                || (!$strict && strpos(mb_strtolower($value), $search) !== false)
-                            ) {
+                            $value = mb_strtolower($value);
+                            if (($strict && $value == $search) || (!$strict && strpos($value, $search) !== false)) {
                                 $found++;
                                 break;
                             }
@@ -349,7 +348,14 @@
             // build WHERE clause
             $ids = $this->db->array2list($ids, 'integer');
             $where = 'c.' . $this->primary_key.' IN ('.$ids.')';
+            // reset counter
             unset($this->cache['count']);
+
+            // when we know we have an empty result
+            if ($ids == '0') {
+                $this->set_search_set($where);
+                return ($this->result = new rcube_result_set(0, 0));
+            }
         }
 
         if (!empty($where)) {

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



More information about the Svn mailing list