Changeset 341d966 in github


Ignore:
Timestamp:
Jul 27, 2011 11:53:48 AM (22 months ago)
Author:
alecpl <alec@…>
Branches:
master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
Children:
733ed0a
Parents:
d917785
Message:
  • Delay imap cache initialization, fixes problem with cache cleanup on login (where user ID wasn't set on init time)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • program/include/rcube_imap.php

    r9220169 r341d966  
    8181    private $options = array('auth_method' => 'check'); 
    8282    private $host, $user, $pass, $port, $ssl; 
     83    private $caching = false; 
    8384 
    8485    /** 
     
    38153816    { 
    38163817        if ($type) { 
    3817             $rcmail = rcmail::get_instance(); 
    3818             $this->cache = $rcmail->get_cache('IMAP', $type); 
     3818            $this->caching = true; 
    38193819        } 
    38203820        else { 
     
    38223822                $this->cache->close(); 
    38233823            $this->cache = null; 
    3824         } 
    3825     } 
    3826  
     3824            $this->caching = false; 
     3825        } 
     3826    } 
     3827 
     3828    /** 
     3829     * Getter for IMAP cache object 
     3830     */ 
     3831    private function get_cache_engine() 
     3832    { 
     3833        if ($this->caching && !$this->cache) { 
     3834            $rcmail = rcmail::get_instance(); 
     3835            $this->cache = $rcmail->get_cache('IMAP', $type); 
     3836        } 
     3837 
     3838        return $this->cache; 
     3839    } 
    38273840 
    38283841    /** 
     
    38353848    function get_cache($key) 
    38363849    { 
    3837         if ($this->cache) { 
    3838             return $this->cache->get($key); 
     3850        if ($cache = $this->get_cache_engine()) { 
     3851            return $cache->get($key); 
    38393852        } 
    38403853    } 
     
    38493862    function update_cache($key, $data) 
    38503863    { 
    3851         if ($this->cache) { 
    3852             $this->cache->set($key, $data); 
     3864        if ($cache = $this->get_cache_engine()) { 
     3865            $cache->set($key, $data); 
    38533866        } 
    38543867    } 
     
    38643877    function clear_cache($key=null, $prefix_mode=false) 
    38653878    { 
    3866         if ($this->cache) { 
    3867             $this->cache->remove($key, $prefix_mode); 
     3879        if ($cache = $this->get_cache_engine()) { 
     3880            $cache->remove($key, $prefix_mode); 
    38683881        } 
    38693882    } 
Note: See TracChangeset for help on using the changeset viewer.