[dev] agora block optimization

Vilius Šumskas vilius at lnk.lt
Wed Mar 9 06:31:00 PST 2005


This message is in MIME format.

--=_716pd4dzdpc0
Content-Type: text/plain;
	charset=UTF-8;
	format="flowed"
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hello,

this patch optimizes my agora block display from 5s to 0.02s.

-- 
  Best Regards,

  Vilius =C5=A0umskas
  LNK TV system administrator
  mob.: +370 614 75713
  http://www.lnk.lt

--=_716pd4dzdpc0
Content-Type: text/plain;
	charset=UTF-8;
	name="Messages.php.patch"
Content-Disposition: attachment;
	filename="Messages.php.patch"
Content-Transfer-Encoding: 7bit

Index: Messages.php
===================================================================
RCS file: /repository/agora/lib/Messages.php,v
retrieving revision 1.121
diff -u -r1.121 Messages.php
--- Messages.php	9 Mar 2005 03:40:20 -0000	1.121
+++ Messages.php	9 Mar 2005 14:25:35 -0000
@@ -403,7 +403,7 @@
         $threads_list = $this->threads->sortByAttributes(array_keys($threads_list), $sorter[0], $sorter[1], $sort_direction);
 
         /* Slice. */
-        if (!is_null($from)) {
+        if (!is_null($from) && !is_null($count)) {
             $threads_list = array_slice($threads_list, $from, $count);
         }
 

--=_716pd4dzdpc0
Content-Type: text/plain;
	charset=UTF-8;
	name="threads.php.patch"
Content-Disposition: attachment;
	filename="threads.php.patch"
Content-Transfer-Encoding: 7bit

Index: threads.php
===================================================================
RCS file: /repository/agora/lib/Block/threads.php,v
retrieving revision 1.39
diff -u -r1.39 threads.php
--- threads.php	3 Jan 2005 14:34:46 -0000	1.39
+++ threads.php	9 Mar 2005 14:24:58 -0000
@@ -103,8 +103,9 @@
             return PEAR::raiseError(_("Unable to fetch threads for selected forum."));
         }
 
-        /* Get a list of threads. */
-        $threads_list = $threads->getThreads($forum_id, false, $sort_by, $sort_dir, false, Horde::selfURL());
+        /* Get a list of threads and display only the most recent if
+         * preference is present. */
+        $threads_list = $threads->getThreads($forum_id, false, $sort_by, $sort_dir, false, Horde::selfURL(), null, 0, !empty($this->_params['thread_display']) ? $this->_params['thread_display'] : null);
 
         /* Show a message if no available threads. Don't raise an error
          * as it is not an error to have no threads. */
@@ -112,11 +113,6 @@
             return _("No available threads.");
         }
 
-        /* Display only the most recent threads if preference set. */
-        if (!empty($this->_params['thread_display'])) {
-            $threads_list = array_slice($threads_list, 0, $this->_params['thread_display']);
-        }
-
         /* Set up the column headers. */
         $col_headers = array('message_subject' => _("Subject"), 'message_author' => _("Posted By"), 'message_date' => _("Date"));
         $col_headers = Agora::formatColumnHeaders($col_headers, $sort_by, $sort_dir, 'threads');

--=_716pd4dzdpc0--



More information about the dev mailing list