Fix for sqlite and session problems

Thomas Bruederli roundcube at gmail.com
Wed Nov 2 07:38:04 CET 2005


Hello list,

I followed your discussion and finally found the problem with session
expiration when using SQLite. RoundCube does not use SQLite for session
management, because I thought that it's file-based anyway and we can use
the default session management of PHP.

But I made a mistake when adding the check for session timeout. The
global var $SESS_CHANGED is only available when using the DB backend for
sessions. If using SQLite the check fails and returns a "session
expired" message.

To fix this, you can either use the patch posted here to create a
sessions table in SQLite and then change the line 68 in
program/include/main.inc from
  if (is_object($DB) && $DB->db_provider!='sqlite')
to
  if (is_object($DB))

or you replace the whole index.php file with the latest CVS version:
http://cvs.sourceforge.net/viewcvs.py/*checkout*/roundcubemail/roundcubemail/index.php?rev=1.19

Regards,
Thomas


Adhamh Findlay wrote:
> So the session table isn't being created when you use sqlite as the database
> type.  This patch fixes the problem and allows successful login.
> 
>  --- sqlite.initial.sql.orig     2005-10-30 09:54:13.000000000 -0800
> +++ sqlite.initial.sql  2005-10-30 09:08:17.000000000 -0800
> @@ -78,3 +78,19 @@
>    language varchar(5) NOT NULL default 'en',
>    preferences text NOT NULL default ''
>  );
> +
> +-- --------------------------------------------------------
> +
> +-- 
> +-- Table structure for table sessions
> +-- 
> +
> +
> +CREATE TABLE session (
> +  sess_id varchar(32) NOT NULL default '',
> +  created datetime NOT NULL default '0000-00-00 00:00:00',
> +  changed datetime NOT NULL default '0000-00-00 00:00:00',
> +  ip VARCHAR(15) NOT NULL default '',
> +  vars text NOT NULL,
> +  PRIMARY KEY  (sess_id)
> +)
> 
> 
> Adhamh
> 





More information about the Dev mailing list