diff --git a/CHANGELOG b/CHANGELOG index 0f4aa53e1..54892f596 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,7 @@ CHANGELOG Roundcube Webmail =========================== +- Removed useless 'created' column from 'session' table (#5389) - Require PHP >= 5.4 - Add possibility to preview and download attachments in mail compose (#5053) - Add possibility to rename attachments in mail compose (#4996) diff --git a/SQL/mssql.initial.sql b/SQL/mssql.initial.sql index 181d61ef3..ac9d93f28 100644 --- a/SQL/mssql.initial.sql +++ b/SQL/mssql.initial.sql @@ -1,7 +1,6 @@ CREATE TABLE [dbo].[cache] ( [user_id] [int] NOT NULL , [cache_key] [varchar] (128) COLLATE Latin1_General_CI_AI NOT NULL , - [created] [datetime] NOT NULL , [expires] [datetime] NULL , [data] [text] COLLATE Latin1_General_CI_AI NOT NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] @@ -315,7 +314,6 @@ GO ALTER TABLE [dbo].[session] ADD CONSTRAINT [DF_session_sess_id] DEFAULT ('') FOR [sess_id], - CONSTRAINT [DF_session_created] DEFAULT (getdate()) FOR [created], CONSTRAINT [DF_session_ip] DEFAULT ('') FOR [ip] GO @@ -395,6 +393,6 @@ CREATE TRIGGER [contact_delete_member] ON [dbo].[contacts] WHERE [contact_id] IN (SELECT [contact_id] FROM deleted) GO -INSERT INTO [dbo].[system] ([name], [value]) VALUES ('roundcube-version', '2015111100') +INSERT INTO [dbo].[system] ([name], [value]) VALUES ('roundcube-version', '2016081200') GO \ No newline at end of file diff --git a/SQL/mssql/2016081200.sql b/SQL/mssql/2016081200.sql new file mode 100644 index 000000000..3f866c395 --- /dev/null +++ b/SQL/mssql/2016081200.sql @@ -0,0 +1,2 @@ +ALTER TABLE [dbo].[session] DROP COLUMN [created] +GO diff --git a/SQL/mysql.initial.sql b/SQL/mysql.initial.sql index df1d015aa..22ffcd043 100644 --- a/SQL/mysql.initial.sql +++ b/SQL/mysql.initial.sql @@ -7,7 +7,6 @@ CREATE TABLE `session` ( `sess_id` varchar(128) NOT NULL, - `created` datetime NOT NULL DEFAULT '1000-01-01 00:00:00', `changed` datetime NOT NULL DEFAULT '1000-01-01 00:00:00', `ip` varchar(40) NOT NULL, `vars` mediumtext NOT NULL, @@ -211,4 +210,4 @@ CREATE TABLE `system` ( /*!40014 SET FOREIGN_KEY_CHECKS=1 */; -INSERT INTO system (name, value) VALUES ('roundcube-version', '2015111100'); +INSERT INTO system (name, value) VALUES ('roundcube-version', '2016081200'); diff --git a/SQL/mysql/2016081200.sql b/SQL/mysql/2016081200.sql new file mode 100644 index 000000000..aa09087ab --- /dev/null +++ b/SQL/mysql/2016081200.sql @@ -0,0 +1 @@ +ALTER TABLE `session` DROP COLUMN `created`; diff --git a/SQL/oracle.initial.sql b/SQL/oracle.initial.sql index 82ee1d89b..fabd2606b 100644 --- a/SQL/oracle.initial.sql +++ b/SQL/oracle.initial.sql @@ -26,7 +26,6 @@ END; CREATE TABLE "session" ( "sess_id" varchar(128) NOT NULL PRIMARY KEY, - "created" timestamp with time zone DEFAULT current_timestamp NOT NULL, "changed" timestamp with time zone DEFAULT current_timestamp NOT NULL, "ip" varchar(41) NOT NULL, "vars" long NOT NULL @@ -220,4 +219,4 @@ CREATE TABLE "system" ( "value" long ); -INSERT INTO "system" ("name", "value") VALUES ('roundcube-version', '2015111100'); +INSERT INTO "system" ("name", "value") VALUES ('roundcube-version', '2016081200'); diff --git a/SQL/oracle/2016081200.sql b/SQL/oracle/2016081200.sql new file mode 100644 index 000000000..aacfe4186 --- /dev/null +++ b/SQL/oracle/2016081200.sql @@ -0,0 +1 @@ +ALTER TABLE "session" DROP COLUMN "created"; diff --git a/SQL/postgres.initial.sql b/SQL/postgres.initial.sql index 2fc85c3a8..6b2c93902 100644 --- a/SQL/postgres.initial.sql +++ b/SQL/postgres.initial.sql @@ -37,7 +37,6 @@ CREATE TABLE users ( CREATE TABLE "session" ( sess_id varchar(128) DEFAULT '' PRIMARY KEY, - created timestamp with time zone DEFAULT now() NOT NULL, changed timestamp with time zone DEFAULT now() NOT NULL, ip varchar(41) NOT NULL, vars text NOT NULL @@ -292,4 +291,4 @@ CREATE TABLE "system" ( value text ); -INSERT INTO system (name, value) VALUES ('roundcube-version', '2015111100'); +INSERT INTO system (name, value) VALUES ('roundcube-version', '2016081200'); diff --git a/SQL/postgres/2016081200.sql b/SQL/postgres/2016081200.sql new file mode 100644 index 000000000..7235b402a --- /dev/null +++ b/SQL/postgres/2016081200.sql @@ -0,0 +1 @@ +ALTER TABLE "session" DROP COLUMN created; diff --git a/SQL/sqlite.initial.sql b/SQL/sqlite.initial.sql index 4c1b7791c..081fe6ab8 100644 --- a/SQL/sqlite.initial.sql +++ b/SQL/sqlite.initial.sql @@ -86,7 +86,6 @@ CREATE UNIQUE INDEX ix_users_username ON users(username, mail_host); CREATE TABLE session ( sess_id varchar(128) NOT NULL PRIMARY KEY, - created datetime NOT NULL default '0000-00-00 00:00:00', changed datetime NOT NULL default '0000-00-00 00:00:00', ip varchar(40) NOT NULL default '', vars text NOT NULL @@ -203,4 +202,4 @@ CREATE TABLE system ( value text NOT NULL ); -INSERT INTO system (name, value) VALUES ('roundcube-version', '2015111100'); +INSERT INTO system (name, value) VALUES ('roundcube-version', '2016081200'); diff --git a/SQL/sqlite/2016081200.sql b/SQL/sqlite/2016081200.sql new file mode 100644 index 000000000..8c3a3f183 --- /dev/null +++ b/SQL/sqlite/2016081200.sql @@ -0,0 +1,9 @@ +DROP TABLE session; +CREATE TABLE session ( + sess_id varchar(128) NOT NULL PRIMARY KEY, + changed datetime NOT NULL default '0000-00-00 00:00:00', + ip varchar(40) NOT NULL default '', + vars text NOT NULL +); + +CREATE INDEX ix_session_changed ON session (changed); diff --git a/program/lib/Roundcube/rcube_session_db.php b/program/lib/Roundcube/rcube_session_db.php index 342788246..892fc7fe8 100644 --- a/program/lib/Roundcube/rcube_session_db.php +++ b/program/lib/Roundcube/rcube_session_db.php @@ -126,8 +126,8 @@ class rcube_session_db extends rcube_session $now = $this->db->now(); $this->db->query("INSERT INTO {$this->table_name}" - . " (`sess_id`, `vars`, `ip`, `created`, `changed`)" - . " VALUES (?, ?, ?, $now, $now)", + . " (`sess_id`, `vars`, `ip`, `changed`)" + . " VALUES (?, ?, ?, $now)", $key, base64_encode($vars), (string)$this->ip); return true;