Aleksander Machniak
2012-08-17 c83b83eeae9806cb60ea3f41f2cff055b0c6ed7e
program/include/rcube.php
@@ -49,14 +49,14 @@
  /**
   * Instace of database class.
   *
   * @var rcube_mdb2
   * @var rcube_pdo
   */
  public $db;
  /**
   * Instace of Memcache class.
   *
   * @var rcube_mdb2
   * @var Memcache
   */
  public $memcache;
@@ -160,15 +160,13 @@
  /**
   * Get the current database connection
   *
   * @return rcube_mdb2  Database connection object
   * @return rcube_pdo  Database connection object
   */
  public function get_dbh()
  {
    if (!$this->db) {
      $config_all = $this->config->all();
      $this->db = new rcube_mdb2($config_all['db_dsnw'], $config_all['db_dsnr'], $config_all['db_persistent']);
      $this->db->sqlite_initials = INSTALL_PATH . 'SQL/sqlite.initial.sql';
      $this->db = rcube_db::factory($config_all['db_dsnw'], $config_all['db_dsnr'], $config_all['db_persistent']);
      $this->db->set_debug((bool)$config_all['sql_debug']);
    }
@@ -193,11 +191,17 @@
      $this->memcache = new Memcache;
      $this->mc_available = 0;
      // add alll configured hosts to pool
      // add all configured hosts to pool
      $pconnect = $this->config->get('memcache_pconnect', true);
      foreach ($this->config->get('memcache_hosts', array()) as $host) {
        list($host, $port) = explode(':', $host);
        if (!$port) $port = 11211;
        if (substr($host, 0, 7) != 'unix://') {
          list($host, $port) = explode(':', $host);
          if (!$port) $port = 11211;
        }
        else {
          $port = 0;
        }
        $this->mc_available += intval($this->memcache->addServer($host, $port, $pconnect, 1, 1, 15, false, array($this, 'memcache_failure')));
      }
@@ -409,6 +413,7 @@
        ini_set('session.use_cookies', 1);
        ini_set('session.use_only_cookies', 1);
        ini_set('session.serialize_handler', 'php');
        ini_set('session.cookie_httponly', 1);
        // use database for storing session data
        $this->session = new rcube_session($this->get_dbh(), $this->config);