Changeset 6bb44a6 in github


Ignore:
Timestamp:
Jun 20, 2012 12:39:54 PM (11 months ago)
Author:
Thomas Bruederli <thomas@…>
Branches:
master, HEAD
Children:
7dc7eb1
Parents:
1fe450b
Message:

Initialize rcube instance (with options); no caches without a valid user_id

Location:
program/include
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • program/include/rcube.php

    r041c93c r6bb44a6  
    107107   * This implements the 'singleton' design pattern 
    108108   * 
     109   * @param integer Options to initialize with this instance. See rcube::INIT_WITH_* constants 
    109110   * @return rcube The one and only instance 
    110111   */ 
    111   static function get_instance() 
     112  static function get_instance($mode = 0) 
    112113  { 
    113114    if (!self::$instance) { 
    114115      self::$instance = new rcube(); 
     116      self::$instance->init($mode); 
    115117    } 
    116118 
     
    241243  public function get_cache($name, $type='db', $ttl=0, $packed=true) 
    242244  { 
    243     if (!isset($this->caches[$name])) { 
    244       $userid = $this->get_user_id(); 
     245    if (!isset($this->caches[$name]) && ($userid = $this->get_user_id())) { 
    245246      $this->caches[$name] = new rcube_cache($type, $userid, $name, $ttl, $packed); 
    246247    } 
  • program/include/rcube_imap.php

    rbdb40d3 r6bb44a6  
    37433743        if ($this->messages_caching && !$this->mcache) { 
    37443744            $rcube = rcube::get_instance(); 
    3745             if ($dbh = $rcube->get_dbh()) { 
     3745            if (($dbh = $rcube->get_dbh()) && ($userid = $rcube->get_user_id())) { 
    37463746                $this->mcache = new rcube_imap_cache( 
    3747                     $dbh, $this, $rcube->get_user_id(), $this->options['skip_deleted']); 
     3747                    $dbh, $this, $userid, $this->options['skip_deleted']); 
    37483748            } 
    37493749        } 
Note: See TracChangeset for help on using the changeset viewer.