alecpl
2009-09-12 59395e7e36995ea8a39a09136ab29961e97fd2fc
- Fix DB constraint violation when populating messages cache (#1486052)


2 files modified
19 ■■■■■ changed files
CHANGELOG 1 ●●●● patch | view | raw | blame | history
program/include/rcube_imap.php 18 ●●●●● patch | view | raw | blame | history
CHANGELOG
@@ -1,6 +1,7 @@
CHANGELOG RoundCube Webmail
===========================
- Fix DB constraint violation when populating messages cache (#1486052)
- Password: added password strength options (#1486062)
- Fix LDAP partial result warning (#1485536)
- Fix delete in message view deletes permanently with flag_for_deletion=true (#1486101)
program/include/rcube_imap.php
@@ -809,10 +809,14 @@
      // cache is incomplete
      $cache_index = $this->get_message_cache_index($cache_key);
      foreach ($a_header_index as $i => $headers)
        {
        // add message to cache
      foreach ($a_header_index as $i => $headers) {
        if ($this->caching_enabled && $cache_index[$headers->id] != $headers->uid) {
      // prevent index duplicates
      if ($cache_index[$headers->id]) {
        $this->remove_message_cache($cache_key, $headers->id, true);
        unset($cache_index[$headers->id]);
        }
          // add message to cache
      $this->add_message_cache($cache_key, $headers->id, $headers, NULL,
        !in_array($headers->uid, $cache_index));
      }
@@ -2430,7 +2434,7 @@
  /**
   * @access private
   */
  private function remove_message_cache($key, $uids)
  private function remove_message_cache($key, $ids, $idx=false)
    {
    if (!$this->caching_enabled)
      return;
@@ -2439,7 +2443,7 @@
      "DELETE FROM ".get_table_name('messages')."
      WHERE  user_id=?
      AND    cache_key=?
      AND    uid IN (".$this->db->array2list($uids, 'integer').")",
      AND ".($idx ? "idx" : "uid")." IN (".$this->db->array2list($ids, 'integer').")",
      $_SESSION['user_id'],
      $key);
    }
@@ -2457,9 +2461,7 @@
       WHERE  user_id=?
       AND    cache_key=?
       AND    idx>=?",
      $_SESSION['user_id'],
      $key,
      $start_index);
      $_SESSION['user_id'], $key, $start_index);
    }
  /**