On Feb 25, 2006, at 2:48 PM, Mark Edwards wrote:

Just looking at the code in question, it looks like it builds a giant array with the box's entire index data in it, which obviously will grow along with the size of the mailbox:

  // get previous and next message UID
$a_msg_index = $IMAP->message_index(NULL, $_SESSION['sort_col'], $_SESSION['sort_order']); $MESSAGE['index'] = array_search((string)$_GET['_uid'], $a_msg_index, TRUE);

  if (isset($a_msg_index[$MESSAGE['index']-1]))
$javascript .= sprintf("\n%s.set_env('prev_uid', '%s');", $JS_OBJECT_NAME, $a_msg_index[$MESSAGE['index']-1]);
  if (isset($a_msg_index[$MESSAGE['index']+1]))
$javascript .= sprintf("\n%s.set_env('next_uid', '%s');", $JS_OBJECT_NAME, $a_msg_index[$MESSAGE['index']+1]);

A little further testing suggests that its the first line that causes the problem:

$a_msg_index = $IMAP->message_index(NULL, $_SESSION['sort_col'], $_SESSION['sort_order']);

Having a quick look at message_index in program/include/ rcube_imap.inc it appears that it returns an array of the index data for the whole mailbox. Why is this necessary to retrieve the UID for two messages? Surely there is a better way to do this?

--
Mark Edwards




Reply via email to