Remove 'sort_limit' configuration option.
authorMichael M Slusarz <slusarz@curecanti.org>
Fri, 5 Mar 2010 16:50:31 +0000 (09:50 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Fri, 5 Mar 2010 19:09:21 +0000 (12:09 -0700)
This option was meant to work around slowness/inadequacies of c-client.
Our Imap_Client library is much faster, so this should not be an issue
moving forward (if someone really wants to sort their 1,000,000 message
mailbox by thread, I guess that should be their option).

imp/config/conf.xml
imp/docs/CHANGES
imp/docs/UPGRADING
imp/js/DimpBase.js
imp/js/mailbox.js
imp/lib/IMP.php
imp/lib/Mailbox.php
imp/lib/Views/ListMessages.php
imp/mailbox-mimp.php
imp/mailbox.php
imp/templates/mailbox/message_headers.html

index d32932b..f1b9fc8 100644 (file)
    list of folders that can't be modified (deleted, renamed, etc) by the user,
    e.g.: &quot;Drafts, Trash&quot;. (The mailbox value must be encoded in the
    UTF7-IMAP charset; see RFC 3501 [5.1.3])"/>
-   <configinteger name="sort_limit" desc="On slower mailservers, sorting by any
-   field other than the arrival of the message may result in very slow
-   performance.  This value, if greater than 0 is the number of messages
-   that must be present in a mailbox before the default sort is replaced by
-   the much faster arrival time sort.">0</configinteger>
    <configboolean name="cache_folders" desc="If using IMAP, should we cache the
    list of folders so that the list does not need to be rebuilt on every page
    load? If set to true, note that any folders created on the server during an
index c48ad94..4bb2093 100644 (file)
@@ -2,6 +2,7 @@
 v5.0-git
 --------
 
+[mms] Remove 'sort_limit' configuration option.
 [mms] Mobile view no longer supports WML output.
 [jan] Implement iTip viewer actions in DIMP (Request #8061).
 [mms] Display alarm notifications in DIMP (Request #6232).
index a18249b..02bc05e 100644 (file)
@@ -49,7 +49,7 @@ hook.
 The 'max_from_chars' and 'max_subj_chars' configuration options for the
 minimal (mimp) display have been removed.
 
-The 'limit_factor' configuration option has been removed.
+The 'limit_factor' and 'sort_limit' configuration options have been removed.
 
 
 Preferences
index 9eb6ead..9b8d201 100644 (file)
@@ -1016,11 +1016,6 @@ var DimpBase = {
 
         e.stop();
 
-        // Don't change sort if we are past the sortlimit
-        if (this.viewport.getMetaData('sortlimit')) {
-            return;
-        }
-
         sortby = Number(sortby);
         if (sortby == this.viewport.getMetaData('sortby')) {
             s = { sortdir: (this.viewport.getMetaData('sortdir') ? 0 : 1) };
@@ -1069,8 +1064,7 @@ var DimpBase = {
         /* Toggle between Subject/Thread header. */
         tmp = m.down('.msgSubject');
         if (this.isSearch() ||
-            this.viewport.getMetaData('nothread') ||
-            this.viewport.getMetaData('sortlimit')) {
+            this.viewport.getMetaData('nothread')) {
             togglesort.push({ l: 'subject', t: tmp });
         } else if (sortby == ptr.get('thread').v) {
             togglesort.push({ l: 'thread', s: 'subject', t: tmp });
index 01eea4e..7317fff 100644 (file)
@@ -7,7 +7,7 @@
 
 var ImpMailbox = {
     // The following variables are defined in mailbox.php:
-    //  sortlimit, unread
+    //  unread
 
     anySelected: function()
     {
@@ -252,8 +252,7 @@ var ImpMailbox = {
                 return;
             }
 
-            if (!this.sortlimit &&
-                elt.match('TH') &&
+            if (elt.match('TH') &&
                 elt.up('TABLE.messageList')) {
                 document.location.href = elt.down('A').href;
             }
index fb0bdf6..b57b136 100644 (file)
@@ -867,9 +867,10 @@ class IMP
      *                      in the session).
      *
      * @return array  An array with the following keys:
-     *                'by'  - Sort type (Horde_Imap_Client constant)
-     *                'dir' - Sort direction
-     *                'limit' - Was the sort limit reached?
+     * <pre>
+     * 'by'  - (integer) Sort type (Horde_Imap_Client constant)
+     * 'dir' - (integer) Sort direction
+     * </pre>
      */
     static public function getSort($mbox = null)
     {
@@ -890,7 +891,6 @@ class IMP
         $ob = array(
             'by' => isset($entry['b']) ? $entry['b'] : $sortby,
             'dir' => isset($entry['d']) ? $entry['d'] : $GLOBALS['prefs']->getValue('sortdir'),
-            'limit' => false
         );
 
         /* Restrict POP3 sorting to arrival only.  Although possible to
@@ -898,7 +898,6 @@ class IMP
          * download of all messages, which is too much overhead.*/
         if ($_SESSION['imp']['protocol'] == 'pop') {
             $ob['by'] = Horde_Imap_Client::SORT_ARRIVAL;
-            $ob['limit'] = true;
             return $ob;
         }
 
@@ -908,28 +907,14 @@ class IMP
             $ob['by'] = Horde_Imap_Client::SORT_DATE;
         }
 
-        if (!$search_mbox &&
-            !empty($GLOBALS['conf']['server']['sort_limit'])) {
-            try {
-                $status = $GLOBALS['imp_imap']->ob()->status($mbox, Horde_Imap_Client::STATUS_MESSAGES);
-                if (isset($status['messages']) &&
-                    ($status['messages'] > $GLOBALS['conf']['server']['sort_limit'])) {
-                    $ob['limit'] = true;
-                    $ob['by'] = Horde_Imap_Client::SORT_ARRIVAL;
-                }
-            } catch (Horde_Imap_Client_Exception $e) {}
-        }
-
-        if (!$ob['limit']) {
-            if (self::isSpecialFolder($mbox)) {
-                /* If the preference is to sort by From Address, when we are
-                 * in the Drafts or Sent folders, sort by To Address. */
-                if ($ob['by'] == Horde_Imap_Client::SORT_FROM) {
-                    $ob['by'] = Horde_Imap_Client::SORT_TO;
-                }
-            } elseif ($ob['by'] == Horde_Imap_Client::SORT_TO) {
-                $ob['by'] = Horde_Imap_Client::SORT_FROM;
+        if (self::isSpecialFolder($mbox)) {
+            /* If the preference is to sort by From Address, when we are
+             * in the Drafts or Sent folders, sort by To Address. */
+            if ($ob['by'] == Horde_Imap_Client::SORT_FROM) {
+                $ob['by'] = Horde_Imap_Client::SORT_TO;
             }
+        } elseif ($ob['by'] == Horde_Imap_Client::SORT_TO) {
+            $ob['by'] = Horde_Imap_Client::SORT_FROM;
         }
 
         return $ob;
index bf2f10f..5ec6c9f 100644 (file)
@@ -806,14 +806,6 @@ class IMP_Mailbox
         /* Update the current array index to its new position in the message
          * array. */
         $this->setIndex(0, 'offset');
-
-        /* If we have a sortlimit, it is possible the sort prefs will have
-         * changed after messages are expunged. */
-        if (!empty($GLOBALS['conf']['server']['sort_limit']) &&
-            ($sortcount > $GLOBALS['conf']['server']['sort_limit']) &&
-            (($sortcount - $msgcount) <= $GLOBALS['conf']['server']['sort_limit'])) {
-            $this->_rebuild(true);
-        }
     }
 
     /**
index 03d3eac..9db9449 100644 (file)
@@ -131,10 +131,6 @@ class IMP_Views_ListMessages
         /* These entries may change during a session, so always need to
          * update them. */
         $md->readonly = intval($GLOBALS['imp_imap']->isReadOnly($mbox));
-        if (!$is_search &&
-            !empty($GLOBALS['conf']['server']['sort_limit'])) {
-            $md->sortlimit = $sortpref['limit'] ? 1 : 0;
-        }
 
         /* Check for mailbox existence now. If there are no messages, there
          * is a chance that the mailbox doesn't exist. If there is at least
index 4899964..96d8bd6 100644 (file)
@@ -188,23 +188,16 @@ $hdr_list = array(
     'hdr_thread' => array(_("Thread"), Horde_Imap_Client::SORT_THREAD)
 );
 foreach ($hdr_list as $key => $val) {
-    if ($search_mbox ||
-        $sortpref['limit'] && ($key != 'hdr_arrival')) {
-        $t->set($key, $val[0]);
+    $sort_link = $mailbox->copy()->add(array('a' => 'c', 'sb' => $val[1]));
+    if ($sortpref['by'] == $val[1]) {
+        $t->set($key, $val[0] . ' <a href="' . strval($sort_link->add('sd', intval(!$sortpref['dir']))) . '">' . ($sortpref['dir'] ? '^' : 'v') . '</a>');
     } else {
-        $sort_link = $mailbox->copy()->add(array('a' => 'c', 'sb' => $val[1]));
-        if ($sortpref['by'] == $val[1]) {
-            $t->set($key, $val[0] . ' <a href="' . strval($sort_link->add('sd', intval(!$sortpref['dir']))) . '">' . ($sortpref['dir'] ? '^' : 'v') . '</a>');
-        } else {
-            $t->set($key, '<a href="' . $sort_link . '">' . $val[0] . '</a>');
-        }
+        $t->set($key, '<a href="' . $sort_link . '">' . $val[0] . '</a>');
     }
 }
 
 /* Add thread header entry. */
-if (!$search_mbox &&
-    !$sortpref['limit'] &&
-    IMP::threadSortAvailable($mailbox)) {
+if (!$search_mbox && IMP::threadSortAvailable($mailbox)) {
     if (is_null($imp_thread)) {
         $t->set('hdr_subject_minor', $t->get('hdr_thread'));
     } else {
index 16f4816..cfa5593 100644 (file)
@@ -650,15 +650,12 @@ if ($pageOb['msgcount']) {
         } else {
             $ptr['change_sort_link'] = null;
         }
-        if ($sortpref['limit']) {
-            $ptr['sortlimit_text'] = Horde::stripAccessKey($val['text']);
-        } else {
-            $tmp = ($sortpref['by'] == $key) ? $sort_url : $mailbox_imp_url;
-            $ptr['change_sort'] = addslashes($tmp->copy()->add(array('sortby' => $key, 'actionID' => 'change_sort', 'mailbox_token' => $mailbox_token)));
-            $ptr['change_sort_widget'] = Horde::widget($tmp->copy()->add(array('sortby' => $key, 'actionID' => 'change_sort', 'mailbox_token' => $mailbox_token)), $val['stext'], 'widget', null, null, $val['text']);
-            if (!isset($val['extra'])) {
-                $ptr['extra'] = null;
-            }
+
+        $tmp = ($sortpref['by'] == $key) ? $sort_url : $mailbox_imp_url;
+        $ptr['change_sort'] = addslashes($tmp->copy()->add(array('sortby' => $key, 'actionID' => 'change_sort', 'mailbox_token' => $mailbox_token)));
+        $ptr['change_sort_widget'] = Horde::widget($tmp->copy()->add(array('sortby' => $key, 'actionID' => 'change_sort', 'mailbox_token' => $mailbox_token)), $val['stext'], 'widget', null, null, $val['text']);
+        if (!isset($val['extra'])) {
+            $ptr['extra'] = null;
         }
     }
 
@@ -671,7 +668,6 @@ if ($pageOb['msgcount']) {
     $mh_template->set('mailbox', htmlspecialchars($imp_mbox['mailbox']));
     $mh_template->set('mailbox_token', $mailbox_token);
     $mh_template->set('sessiontag', Horde_Util::formInput());
-    $mh_template->set('sortlimit', $sortpref['limit']);
     $mh_template->set('headers', $headers);
 
     if (!$search_mbox) {
@@ -846,7 +842,6 @@ if (($pageOb['end'] - $pageOb['begin']) >= 20) {
 }
 
 Horde::addInlineScript(array(
-    'ImpMailbox.sortlimit = ' . intval($sortpref['limit']),
     'ImpMailbox.unread = ' . strval($unread)
 ));
 
index 6424135..cd5c70b 100644 (file)
@@ -15,8 +15,8 @@
   </th>
 </else:mh_count></if:mh_count>
 <loop:headers>
-<th class="<tag:headers.class />" width="<tag:headers.width />">
-   <tag:headers.change_sort_link /> <if:sortlimit><tag:headers.sortlimit_text /><else:sortlimit><tag:headers.change_sort_widget /> <tag:headers.extra /></else:sortlimit></if:sortlimit>
+  <th class="<tag:headers.class />" width="<tag:headers.width />">
+   <tag:headers.change_sort_link /> <tag:headers.change_sort_widget /> <tag:headers.extra />
   </th>
 </loop:headers>
  </tr>