# HG changeset patch
# User Charlie Root
# Date 1546085254 18000
# Node ID bf99236cc5cda9da13a5d1a7ffaab3d408957f26
# Parent 65fd7d441cf1f9f6c8e60aacb1e3c2be6af80b51
try to recover from upgrade fail
diff -r 65fd7d441cf1 -r bf99236cc5cd SQL/mssql.initial.sql
--- a/SQL/mssql.initial.sql Sat Dec 29 06:32:49 2018 -0500
+++ b/SQL/mssql.initial.sql Sat Dec 29 07:07:34 2018 -0500
@@ -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]
@@ -9,7 +8,6 @@
CREATE TABLE [dbo].[cache_shared] (
[cache_key] [varchar] (255) 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]
@@ -90,7 +88,6 @@
CREATE TABLE [dbo].[session] (
[sess_id] [varchar] (128) COLLATE Latin1_General_CI_AI NOT NULL ,
- [created] [datetime] NOT NULL ,
[changed] [datetime] NULL ,
[ip] [varchar] (40) COLLATE Latin1_General_CI_AI NOT NULL ,
[vars] [text] COLLATE Latin1_General_CI_AI NOT NULL
@@ -103,6 +100,8 @@
[mail_host] [varchar] (128) COLLATE Latin1_General_CI_AI NOT NULL ,
[created] [datetime] NOT NULL ,
[last_login] [datetime] NULL ,
+ [failed_login] [datetime] NULL ,
+ [failed_login_counter] [int] NULL ,
[language] [varchar] (5) COLLATE Latin1_General_CI_AI NULL ,
[preferences] [text] COLLATE Latin1_General_CI_AI NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
@@ -130,6 +129,20 @@
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
+ALTER TABLE [dbo].[cache] WITH NOCHECK ADD
+ PRIMARY KEY CLUSTERED
+ (
+ [user_id],[cache_key]
+ ) ON [PRIMARY]
+GO
+
+ALTER TABLE [dbo].[cache_shared] WITH NOCHECK ADD
+ PRIMARY KEY CLUSTERED
+ (
+ [cache_key]
+ ) ON [PRIMARY]
+GO
+
ALTER TABLE [dbo].[cache_index] WITH NOCHECK ADD
PRIMARY KEY CLUSTERED
(
@@ -210,11 +223,6 @@
ALTER TABLE [dbo].[cache] ADD
CONSTRAINT [DF_cache_user_id] DEFAULT ('0') FOR [user_id],
CONSTRAINT [DF_cache_cache_key] DEFAULT ('') FOR [cache_key],
- CONSTRAINT [DF_cache_created] DEFAULT (getdate()) FOR [created]
-GO
-
-ALTER TABLE [dbo].[cache_shared] ADD
- CONSTRAINT [DF_cache_shared_created] DEFAULT (getdate()) FOR [created]
GO
ALTER TABLE [dbo].[cache_index] ADD
@@ -225,12 +233,6 @@
CONSTRAINT [DF_cache_messages_flags] DEFAULT (0) FOR [flags]
GO
-CREATE INDEX [IX_cache_user_id] ON [dbo].[cache]([user_id]) ON [PRIMARY]
-GO
-
-CREATE INDEX [IX_cache_cache_key] ON [dbo].[cache]([cache_key]) ON [PRIMARY]
-GO
-
CREATE INDEX [IX_cache_shared_cache_key] ON [dbo].[cache_shared]([cache_key]) ON [PRIMARY]
GO
@@ -313,7 +315,6 @@
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
@@ -393,6 +394,6 @@
WHERE [contact_id] IN (SELECT [contact_id] FROM deleted)
GO
-INSERT INTO [dbo].[system] ([name], [value]) VALUES ('roundcube-version', '2015030800')
+INSERT INTO [dbo].[system] ([name], [value]) VALUES ('roundcube-version', '2016112200')
GO
\ No newline at end of file
diff -r 65fd7d441cf1 -r bf99236cc5cd SQL/mssql/2015111100.sql
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/SQL/mssql/2015111100.sql Sat Dec 29 07:07:34 2018 -0500
@@ -0,0 +1,4 @@
+ALTER TABLE [dbo].[users] ADD [failed_login] [datetime] NULL
+GO
+ALTER TABLE [dbo].[users] ADD [failed_login_counter] [int] NULL
+GO
diff -r 65fd7d441cf1 -r bf99236cc5cd SQL/mssql/2016081200.sql
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/SQL/mssql/2016081200.sql Sat Dec 29 07:07:34 2018 -0500
@@ -0,0 +1,2 @@
+ALTER TABLE [dbo].[session] DROP COLUMN [created]
+GO
diff -r 65fd7d441cf1 -r bf99236cc5cd SQL/mssql/2016100900.sql
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/SQL/mssql/2016100900.sql Sat Dec 29 07:07:34 2018 -0500
@@ -0,0 +1,2 @@
+ALTER TABLE [dbo].[session] ALTER COLUMN [ip] [varchar] (40) COLLATE Latin1_General_CI_AI NOT NULL
+GO
diff -r 65fd7d441cf1 -r bf99236cc5cd SQL/mssql/2016112200.sql
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/SQL/mssql/2016112200.sql Sat Dec 29 07:07:34 2018 -0500
@@ -0,0 +1,36 @@
+DROP TABLE [dbo].[cache]
+GO
+DROP TABLE [dbo].[cache_shared]
+GO
+
+CREATE TABLE [dbo].[cache] (
+ [user_id] [int] NOT NULL ,
+ [cache_key] [varchar] (128) COLLATE Latin1_General_CI_AI NOT NULL ,
+ [expires] [datetime] NULL ,
+ [data] [text] COLLATE Latin1_General_CI_AI NOT NULL
+) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
+GO
+CREATE TABLE [dbo].[cache_shared] (
+ [cache_key] [varchar] (255) COLLATE Latin1_General_CI_AI NOT NULL ,
+ [expires] [datetime] NULL ,
+ [data] [text] COLLATE Latin1_General_CI_AI NOT NULL
+) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
+GO
+ALTER TABLE [dbo].[cache] ADD
+ CONSTRAINT [DF_cache_user_id] DEFAULT ('0') FOR [user_id],
+ CONSTRAINT [DF_cache_cache_key] DEFAULT ('') FOR [cache_key],
+GO
+CREATE INDEX [IX_cache_expires] ON [dbo].[cache]([expires]) ON [PRIMARY]
+GO
+CREATE INDEX [IX_cache_shared_expires] ON [dbo].[cache_shared]([expires]) ON [PRIMARY]
+GO
+ALTER TABLE [dbo].[cache] WITH NOCHECK ADD
+ PRIMARY KEY CLUSTERED (
+ [user_id],[cache_key]
+ ) ON [PRIMARY]
+GO
+ALTER TABLE [dbo].[cache_shared] WITH NOCHECK ADD
+ PRIMARY KEY CLUSTERED (
+ [cache_key]
+ ) ON [PRIMARY]
+GO
diff -r 65fd7d441cf1 -r bf99236cc5cd SQL/mysql.initial.sql
--- a/SQL/mysql.initial.sql Sat Dec 29 06:32:49 2018 -0500
+++ b/SQL/mysql.initial.sql Sat Dec 29 07:07:34 2018 -0500
@@ -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,
@@ -24,6 +23,8 @@
`mail_host` varchar(128) NOT NULL,
`created` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
`last_login` datetime DEFAULT NULL,
+ `failed_login` datetime DEFAULT NULL,
+ `failed_login_counter` int(10) UNSIGNED DEFAULT NULL,
`language` varchar(5),
`preferences` longtext,
PRIMARY KEY(`user_id`),
@@ -36,13 +37,12 @@
CREATE TABLE `cache` (
`user_id` int(10) UNSIGNED NOT NULL,
`cache_key` varchar(128) /*!40101 CHARACTER SET ascii COLLATE ascii_general_ci */ NOT NULL,
- `created` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
`expires` datetime DEFAULT NULL,
`data` longtext NOT NULL,
+ PRIMARY KEY (`user_id`, `cache_key`),
CONSTRAINT `user_id_fk_cache` FOREIGN KEY (`user_id`)
REFERENCES `users`(`user_id`) ON DELETE CASCADE ON UPDATE CASCADE,
- INDEX `expires_index` (`expires`),
- INDEX `user_cache_index` (`user_id`,`cache_key`)
+ INDEX `expires_index` (`expires`)
) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
@@ -50,11 +50,10 @@
CREATE TABLE `cache_shared` (
`cache_key` varchar(255) /*!40101 CHARACTER SET ascii COLLATE ascii_general_ci */ NOT NULL,
- `created` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
`expires` datetime DEFAULT NULL,
`data` longtext NOT NULL,
- INDEX `expires_index` (`expires`),
- INDEX `cache_key_index` (`cache_key`)
+ PRIMARY KEY (`cache_key`),
+ INDEX `expires_index` (`expires`)
) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
@@ -175,7 +174,8 @@
-- Table structure for table `dictionary`
CREATE TABLE `dictionary` (
- `user_id` int(10) UNSIGNED DEFAULT NULL,
+ `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, -- redundant, for compat. with Galera Cluster
+ `user_id` int(10) UNSIGNED DEFAULT NULL, -- NULL here is for "shared dictionaries"
`language` varchar(5) NOT NULL,
`data` longtext NOT NULL,
CONSTRAINT `user_id_fk_dictionary` FOREIGN KEY (`user_id`)
@@ -209,4 +209,4 @@
/*!40014 SET FOREIGN_KEY_CHECKS=1 */;
-INSERT INTO system (name, value) VALUES ('roundcube-version', '2015030800');
+INSERT INTO system (name, value) VALUES ('roundcube-version', '2016112200');
diff -r 65fd7d441cf1 -r bf99236cc5cd SQL/mysql/2015111100.sql
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/SQL/mysql/2015111100.sql Sat Dec 29 07:07:34 2018 -0500
@@ -0,0 +1,3 @@
+ALTER TABLE `users`
+ ADD `failed_login` datetime DEFAULT NULL,
+ ADD `failed_login_counter` int(10) UNSIGNED DEFAULT NULL;
diff -r 65fd7d441cf1 -r bf99236cc5cd SQL/mysql/2016081200.sql
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/SQL/mysql/2016081200.sql Sat Dec 29 07:07:34 2018 -0500
@@ -0,0 +1,1 @@
+ALTER TABLE `session` DROP COLUMN `created`;
diff -r 65fd7d441cf1 -r bf99236cc5cd SQL/mysql/2016100900.sql
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/SQL/mysql/2016100900.sql Sat Dec 29 07:07:34 2018 -0500
@@ -0,0 +1,1 @@
+ALTER TABLE `session` MODIFY `ip` varchar(40) NOT NULL;
diff -r 65fd7d441cf1 -r bf99236cc5cd SQL/mysql/2016112200.sql
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/SQL/mysql/2016112200.sql Sat Dec 29 07:07:34 2018 -0500
@@ -0,0 +1,24 @@
+ALTER TABLE `dictionary` ADD COLUMN `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST; -- redundant, for compat. with Galera Cluster
+
+DROP TABLE `cache`;
+DROP TABLE `cache_shared`;
+
+CREATE TABLE `cache` (
+ `user_id` int(10) UNSIGNED NOT NULL,
+ `cache_key` varchar(128) /*!40101 CHARACTER SET ascii COLLATE ascii_general_ci */ NOT NULL,
+ `expires` datetime DEFAULT NULL,
+ `data` longtext NOT NULL,
+ PRIMARY KEY (`user_id`, `cache_key`),
+ CONSTRAINT `user_id_fk_cache` FOREIGN KEY (`user_id`)
+ REFERENCES `users`(`user_id`) ON DELETE CASCADE ON UPDATE CASCADE,
+ INDEX `expires_index` (`expires`)
+) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
+
+
+CREATE TABLE `cache_shared` (
+ `cache_key` varchar(255) /*!40101 CHARACTER SET ascii COLLATE ascii_general_ci */ NOT NULL,
+ `expires` datetime DEFAULT NULL,
+ `data` longtext NOT NULL,
+ PRIMARY KEY (`cache_key`),
+ INDEX `expires_index` (`expires`)
+) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
diff -r 65fd7d441cf1 -r bf99236cc5cd SQL/oracle.initial.sql
--- a/SQL/oracle.initial.sql Sat Dec 29 06:32:49 2018 -0500
+++ b/SQL/oracle.initial.sql Sat Dec 29 07:07:34 2018 -0500
@@ -7,6 +7,8 @@
"mail_host" varchar(128) NOT NULL,
"created" timestamp with time zone DEFAULT current_timestamp NOT NULL,
"last_login" timestamp with time zone DEFAULT NULL,
+ "failed_login" timestamp with time zone DEFAULT NULL,
+ "failed_login_counter" integer DEFAULT NULL,
"language" varchar(5),
"preferences" long DEFAULT NULL,
CONSTRAINT "users_username_key" UNIQUE ("username", "mail_host")
@@ -24,7 +26,6 @@
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
@@ -125,23 +126,21 @@
"user_id" integer NOT NULL
REFERENCES "users" ("user_id") ON DELETE CASCADE,
"cache_key" varchar(128) NOT NULL,
- "created" timestamp with time zone DEFAULT current_timestamp NOT NULL,
"expires" timestamp with time zone DEFAULT NULL,
- "data" long NOT NULL
+ "data" long NOT NULL,
+ PRIMARY KEY ("user_id", "cache_key")
);
-CREATE INDEX "cache_user_id_idx" ON "cache" ("user_id", "cache_key");
CREATE INDEX "cache_expires_idx" ON "cache" ("expires");
CREATE TABLE "cache_shared" (
"cache_key" varchar(255) NOT NULL,
- "created" timestamp with time zone DEFAULT current_timestamp NOT NULL,
"expires" timestamp with time zone DEFAULT NULL,
- "data" long NOT NULL
+ "data" long NOT NULL,
+ PRIMARY KEY ("cache_key")
);
-CREATE INDEX "cache_shared_cache_key_idx" ON "cache_shared" ("cache_key");
CREATE INDEX "cache_shared_expires_idx" ON "cache_shared" ("expires");
@@ -218,4 +217,4 @@
"value" long
);
-INSERT INTO "system" ("name", "value") VALUES ('roundcube-version', '2015030800');
+INSERT INTO "system" ("name", "value") VALUES ('roundcube-version', '2016112200');
diff -r 65fd7d441cf1 -r bf99236cc5cd SQL/oracle/2015111100.sql
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/SQL/oracle/2015111100.sql Sat Dec 29 07:07:34 2018 -0500
@@ -0,0 +1,2 @@
+ALTER TABLE "users" ADD "failed_login" timestamp with time zone DEFAULT NULL;
+ALTER TABLE "users" ADD "failed_login_counter" integer DEFAULT NULL;
diff -r 65fd7d441cf1 -r bf99236cc5cd SQL/oracle/2016081200.sql
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/SQL/oracle/2016081200.sql Sat Dec 29 07:07:34 2018 -0500
@@ -0,0 +1,1 @@
+ALTER TABLE "session" DROP COLUMN "created";
diff -r 65fd7d441cf1 -r bf99236cc5cd SQL/oracle/2016100900.sql
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/SQL/oracle/2016100900.sql Sat Dec 29 07:07:34 2018 -0500
@@ -0,0 +1,1 @@
+ALTER TABLE "session" MODIFY "ip" varchar(41) NOT NULL;
diff -r 65fd7d441cf1 -r bf99236cc5cd SQL/oracle/2016112200.sql
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/SQL/oracle/2016112200.sql Sat Dec 29 07:07:34 2018 -0500
@@ -0,0 +1,23 @@
+DROP TABLE "cache";
+DROP TABLE "cache_shared";
+
+CREATE TABLE "cache" (
+ "user_id" integer NOT NULL
+ REFERENCES "users" ("user_id") ON DELETE CASCADE,
+ "cache_key" varchar(128) NOT NULL,
+ "expires" timestamp with time zone DEFAULT NULL,
+ "data" long NOT NULL,
+ PRIMARY KEY ("user_id", "cache_key")
+);
+
+CREATE INDEX "cache_expires_idx" ON "cache" ("expires");
+
+
+CREATE TABLE "cache_shared" (
+ "cache_key" varchar(255) NOT NULL,
+ "expires" timestamp with time zone DEFAULT NULL,
+ "data" long NOT NULL,
+ PRIMARY KEY ("cache_key")
+);
+
+CREATE INDEX "cache_shared_expires_idx" ON "cache_shared" ("expires");
diff -r 65fd7d441cf1 -r bf99236cc5cd SQL/postgres.initial.sql
--- a/SQL/postgres.initial.sql Sat Dec 29 06:32:49 2018 -0500
+++ b/SQL/postgres.initial.sql Sat Dec 29 07:07:34 2018 -0500
@@ -22,6 +22,8 @@
mail_host varchar(128) DEFAULT '' NOT NULL,
created timestamp with time zone DEFAULT now() NOT NULL,
last_login timestamp with time zone DEFAULT NULL,
+ failed_login timestamp with time zone DEFAULT NULL,
+ failed_login_counter integer DEFAULT NULL,
"language" varchar(5),
preferences text DEFAULT ''::text NOT NULL,
CONSTRAINT users_username_key UNIQUE (username, mail_host)
@@ -35,7 +37,6 @@
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
@@ -166,12 +167,11 @@
user_id integer NOT NULL
REFERENCES users (user_id) ON DELETE CASCADE ON UPDATE CASCADE,
cache_key varchar(128) DEFAULT '' NOT NULL,
- created timestamp with time zone DEFAULT now() NOT NULL,
expires timestamp with time zone DEFAULT NULL,
- data text NOT NULL
+ data text NOT NULL,
+ PRIMARY KEY (user_id, cache_key)
);
-CREATE INDEX cache_user_id_idx ON "cache" (user_id, cache_key);
CREATE INDEX cache_expires_idx ON "cache" (expires);
--
@@ -180,13 +180,11 @@
--
CREATE TABLE "cache_shared" (
- cache_key varchar(255) NOT NULL,
- created timestamp with time zone DEFAULT now() NOT NULL,
+ cache_key varchar(255) NOT NULL PRIMARY KEY,
expires timestamp with time zone DEFAULT NULL,
data text NOT NULL
);
-CREATE INDEX cache_shared_cache_key_idx ON "cache_shared" (cache_key);
CREATE INDEX cache_shared_expires_idx ON "cache_shared" (expires);
--
@@ -290,4 +288,4 @@
value text
);
-INSERT INTO system (name, value) VALUES ('roundcube-version', '2015030800');
+INSERT INTO system (name, value) VALUES ('roundcube-version', '2016112200');
diff -r 65fd7d441cf1 -r bf99236cc5cd SQL/postgres/2015111100.sql
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/SQL/postgres/2015111100.sql Sat Dec 29 07:07:34 2018 -0500
@@ -0,0 +1,2 @@
+ALTER TABLE "users" ADD failed_login timestamp with time zone DEFAULT NULL;
+ALTER TABLE "users" ADD failed_login_counter integer DEFAULT NULL;
diff -r 65fd7d441cf1 -r bf99236cc5cd SQL/postgres/2016081200.sql
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/SQL/postgres/2016081200.sql Sat Dec 29 07:07:34 2018 -0500
@@ -0,0 +1,1 @@
+ALTER TABLE "session" DROP COLUMN created;
diff -r 65fd7d441cf1 -r bf99236cc5cd SQL/postgres/2016100900.sql
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/SQL/postgres/2016100900.sql Sat Dec 29 07:07:34 2018 -0500
@@ -0,0 +1,1 @@
+ALTER TABLE session ALTER COLUMN ip TYPE character varying(41);
diff -r 65fd7d441cf1 -r bf99236cc5cd SQL/postgres/2016112200.sql
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/SQL/postgres/2016112200.sql Sat Dec 29 07:07:34 2018 -0500
@@ -0,0 +1,21 @@
+DROP TABLE "cache";
+DROP TABLE "cache_shared";
+
+CREATE TABLE "cache" (
+ user_id integer NOT NULL
+ REFERENCES users (user_id) ON DELETE CASCADE ON UPDATE CASCADE,
+ cache_key varchar(128) DEFAULT '' NOT NULL,
+ expires timestamp with time zone DEFAULT NULL,
+ data text NOT NULL,
+ PRIMARY KEY (user_id, cache_key)
+);
+
+CREATE INDEX cache_expires_idx ON "cache" (expires);
+
+CREATE TABLE "cache_shared" (
+ cache_key varchar(255) NOT NULL PRIMARY KEY,
+ expires timestamp with time zone DEFAULT NULL,
+ data text NOT NULL
+);
+
+CREATE INDEX cache_shared_expires_idx ON "cache_shared" (expires);
diff -r 65fd7d441cf1 -r bf99236cc5cd SQL/sqlite.initial.sql
--- a/SQL/sqlite.initial.sql Sat Dec 29 06:32:49 2018 -0500
+++ b/SQL/sqlite.initial.sql Sat Dec 29 07:07:34 2018 -0500
@@ -72,6 +72,8 @@
mail_host varchar(128) NOT NULL default '',
created datetime NOT NULL default '0000-00-00 00:00:00',
last_login datetime DEFAULT NULL,
+ failed_login datetime DEFAULT NULL,
+ failed_login_counter integer DEFAULT NULL,
language varchar(5),
preferences text NOT NULL default ''
);
@@ -84,7 +86,6 @@
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
@@ -125,12 +126,11 @@
CREATE TABLE cache (
user_id integer NOT NULL default 0,
cache_key varchar(128) NOT NULL default '',
- created datetime NOT NULL default '0000-00-00 00:00:00',
expires datetime DEFAULT NULL,
- data text NOT NULL
+ data text NOT NULL,
+ PRIMARY KEY (user_id, cache_key)
);
-CREATE INDEX ix_cache_user_cache_key ON cache(user_id, cache_key);
CREATE INDEX ix_cache_expires ON cache(expires);
--
@@ -139,12 +139,11 @@
CREATE TABLE cache_shared (
cache_key varchar(255) NOT NULL,
- created datetime NOT NULL default '0000-00-00 00:00:00',
expires datetime DEFAULT NULL,
- data text NOT NULL
+ data text NOT NULL,
+ PRIMARY KEY (cache_key)
);
-CREATE INDEX ix_cache_shared_cache_key ON cache_shared(cache_key);
CREATE INDEX ix_cache_shared_expires ON cache_shared(expires);
--
@@ -201,4 +200,4 @@
value text NOT NULL
);
-INSERT INTO system (name, value) VALUES ('roundcube-version', '2015030800');
+INSERT INTO system (name, value) VALUES ('roundcube-version', '2016112200');
diff -r 65fd7d441cf1 -r bf99236cc5cd SQL/sqlite/2015111100.sql
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/SQL/sqlite/2015111100.sql Sat Dec 29 07:07:34 2018 -0500
@@ -0,0 +1,35 @@
+CREATE TABLE tmp_users (
+ user_id integer NOT NULL PRIMARY KEY,
+ username varchar(128) NOT NULL default '',
+ mail_host varchar(128) NOT NULL default '',
+ created datetime NOT NULL default '0000-00-00 00:00:00',
+ last_login datetime DEFAULT NULL,
+ failed_login datetime DEFAULT NULL,
+ failed_login_counter integer DEFAULT NULL,
+ language varchar(5),
+ preferences text NOT NULL default ''
+);
+
+INSERT INTO tmp_users (user_id, username, mail_host, created, last_login, language, preferences)
+ SELECT user_id, username, mail_host, created, last_login, language, preferences FROM users;
+
+DROP TABLE users;
+
+CREATE TABLE users (
+ user_id integer NOT NULL PRIMARY KEY,
+ username varchar(128) NOT NULL default '',
+ mail_host varchar(128) NOT NULL default '',
+ created datetime NOT NULL default '0000-00-00 00:00:00',
+ last_login datetime DEFAULT NULL,
+ failed_login datetime DEFAULT NULL,
+ failed_login_counter integer DEFAULT NULL,
+ language varchar(5),
+ preferences text NOT NULL default ''
+);
+
+INSERT INTO users (user_id, username, mail_host, created, last_login, language, preferences)
+ SELECT user_id, username, mail_host, created, last_login, language, preferences FROM tmp_users;
+
+CREATE UNIQUE INDEX ix_users_username ON users(username, mail_host);
+
+DROP TABLE tmp_users;
diff -r 65fd7d441cf1 -r bf99236cc5cd SQL/sqlite/2016081200.sql
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/SQL/sqlite/2016081200.sql Sat Dec 29 07:07:34 2018 -0500
@@ -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 -r 65fd7d441cf1 -r bf99236cc5cd SQL/sqlite/2016100900.sql
diff -r 65fd7d441cf1 -r bf99236cc5cd SQL/sqlite/2016112200.sql
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/SQL/sqlite/2016112200.sql Sat Dec 29 07:07:34 2018 -0500
@@ -0,0 +1,21 @@
+DROP TABLE cache;
+DROP TABLE cache_shared;
+
+CREATE TABLE cache (
+ user_id integer NOT NULL default 0,
+ cache_key varchar(128) NOT NULL default '',
+ expires datetime DEFAULT NULL,
+ data text NOT NULL,
+ PRIMARY KEY (user_id, cache_key)
+);
+
+CREATE INDEX ix_cache_expires ON cache(expires);
+
+CREATE TABLE cache_shared (
+ cache_key varchar(255) NOT NULL,
+ expires datetime DEFAULT NULL,
+ data text NOT NULL,
+ PRIMARY KEY (cache_key)
+);
+
+CREATE INDEX ix_cache_shared_expires ON cache_shared(expires);
diff -r 65fd7d441cf1 -r bf99236cc5cd bin/cleandb.sh
--- a/bin/cleandb.sh Sat Dec 29 06:32:49 2018 -0500
+++ b/bin/cleandb.sh Sat Dec 29 07:07:34 2018 -0500
@@ -5,7 +5,7 @@
| bin/cleandb.sh |
| |
| This file is part of the Roundcube Webmail client |
- | Copyright (C) 2010, The Roundcube Dev Team |
+ | Copyright (C) 2010-2015, The Roundcube Dev Team |
| |
| Licensed under the GNU General Public License version 3 or |
| any later version with exceptions for skins & plugins. |
@@ -23,56 +23,11 @@
require INSTALL_PATH.'program/include/clisetup.php';
-// mapping for table name => primary key
-$primary_keys = array(
- 'contacts' => "contact_id",
- 'contactgroups' => "contactgroup_id",
-);
-
-// connect to DB
-$RCMAIL = rcube::get_instance();
-$db = $RCMAIL->get_dbh();
-$db->db_connect('w');
-
-if (!$db->is_connected() || $db->is_error()) {
- rcube::raise_error("No DB connection", false, true);
-}
-
if (!empty($_SERVER['argv'][1]))
$days = intval($_SERVER['argv'][1]);
else
$days = 7;
-// remove all deleted records older than two days
-$threshold = date('Y-m-d 00:00:00', time() - $days * 86400);
-
-foreach (array('contacts','contactgroups','identities') as $table) {
-
- $sqltable = $db->table_name($table, true);
-
- // also delete linked records
- // could be skipped for databases which respect foreign key constraints
- if ($db->db_provider == 'sqlite'
- && ($table == 'contacts' || $table == 'contactgroups')
- ) {
- $pk = $primary_keys[$table];
- $memberstable = $db->table_name('contactgroupmembers');
-
- $db->query(
- "DELETE FROM " . $db->quote_identifier($memberstable).
- " WHERE `$pk` IN (".
- "SELECT `$pk` FROM $sqltable".
- " WHERE `del` = 1 AND `changed` < ?".
- ")",
- $threshold);
-
- echo $db->affected_rows() . " records deleted from '$memberstable'\n";
- }
-
- // delete outdated records
- $db->query("DELETE FROM $sqltable WHERE `del` = 1 AND `changed` < ?", $threshold);
-
- echo $db->affected_rows() . " records deleted from '$table'\n";
-}
+rcmail_utils::db_clean($days);
?>
diff -r 65fd7d441cf1 -r bf99236cc5cd bin/deluser.sh
--- a/bin/deluser.sh Sat Dec 29 06:32:49 2018 -0500
+++ b/bin/deluser.sh Sat Dec 29 07:07:34 2018 -0500
@@ -37,7 +37,7 @@
exit(1);
}
-$rcmail = rcmail::get_instance();
+$rcmail = rcube::get_instance();
// get arguments
$args = rcube_utils::get_opt(array('h' => 'host'));
diff -r 65fd7d441cf1 -r bf99236cc5cd bin/indexcontacts.sh
--- a/bin/indexcontacts.sh Sat Dec 29 06:32:49 2018 -0500
+++ b/bin/indexcontacts.sh Sat Dec 29 07:07:34 2018 -0500
@@ -24,31 +24,6 @@
require_once INSTALL_PATH.'program/include/clisetup.php';
ini_set('memory_limit', -1);
-// connect to DB
-$RCMAIL = rcube::get_instance();
-
-$db = $RCMAIL->get_dbh();
-$db->db_connect('w');
-
-if (!$db->is_connected() || $db->is_error()) {
- rcube::raise_error("No DB connection", false, true);
-}
-
-// iterate over all users
-$sql_result = $db->query("SELECT `user_id` FROM " . $db->table_name('users', true) . " ORDER BY `user_id`");
-while ($sql_result && ($sql_arr = $db->fetch_assoc($sql_result))) {
- echo "Indexing contacts for user " . $sql_arr['user_id'] . "...";
-
- $contacts = new rcube_contacts($db, $sql_arr['user_id']);
- $contacts->set_pagesize(9999);
-
- $result = $contacts->list_records();
- while ($result->count && ($row = $result->next())) {
- unset($row['words']);
- $contacts->update($row['ID'], $row);
- }
-
- echo "done.\n";
-}
+rcmail_utils::indexcontacts();
?>
diff -r 65fd7d441cf1 -r bf99236cc5cd bin/installto.sh
--- a/bin/installto.sh Sat Dec 29 06:32:49 2018 -0500
+++ b/bin/installto.sh Sat Dec 29 07:07:34 2018 -0500
@@ -5,7 +5,7 @@
| bin/installto.sh |
| |
| This file is part of the Roundcube Webmail client |
- | Copyright (C) 2014, The Roundcube Dev Team |
+ | Copyright (C) 2014-2016, The Roundcube Dev Team |
| |
| Licensed under the GNU General Public License version 3 or |
| any later version with exceptions for skins & plugins. |
@@ -23,6 +23,10 @@
require_once INSTALL_PATH . 'program/include/clisetup.php';
+if (!function_exists('system')) {
+ rcube::raise_error("PHP system() function is required. Check disable_functions in php.ini.", false, true);
+}
+
$target_dir = unslashify($_SERVER['argv'][1]);
if (empty($target_dir) || !is_dir(realpath($target_dir)))
@@ -42,27 +46,47 @@
$input = trim(fgets(STDIN));
if (strtolower($input) == 'y') {
- $err = false;
echo "Copying files to target location...";
+
+ // Save a copy of original .htaccess file (#1490623)
+ if (file_exists("$target_dir/.htaccess")) {
+ $htaccess_copied = copy("$target_dir/.htaccess", "$target_dir/.htaccess.orig");
+ }
+
$dirs = array('program','installer','bin','SQL','plugins','skins');
- if (is_dir(INSTALL_PATH . 'vendor') && !is_file(INSTALL_PATH . 'composer.json')) {
+ if (is_dir(INSTALL_PATH . 'vendor') && !is_file("$target_dir/composer.json")) {
$dirs[] = 'vendor';
}
foreach ($dirs as $dir) {
- if (!system("rsync -avC " . INSTALL_PATH . "$dir/* $target_dir/$dir/")) {
- $err = true;
- break;
+ // @FIXME: should we use --delete for all directories?
+ $delete = in_array($dir, array('program', 'installer', 'vendor')) ? '--delete ' : '';
+ $command = "rsync -aC --out-format=%n " . $delete . INSTALL_PATH . "$dir/ $target_dir/$dir/";
+ if (system($command, $ret) === false || $ret > 0) {
+ rcube::raise_error("Failed to execute command: $command", false, true);
+ }
+ }
+ foreach (array('index.php','.htaccess','config/defaults.inc.php','composer.json-dist','jsdeps.json','CHANGELOG','README.md','UPGRADING','LICENSE','INSTALL') as $file) {
+ $command = "rsync -a --out-format=%n " . INSTALL_PATH . "$file $target_dir/$file";
+ if (file_exists(INSTALL_PATH . $file) && (system($command, $ret) === false || $ret > 0)) {
+ rcube::raise_error("Failed to execute command: $command", false, true);
}
}
- foreach (array('index.php','.htaccess','config/defaults.inc.php','composer.json-dist','CHANGELOG','README.md','UPGRADING','LICENSE','INSTALL') as $file) {
- if (!system("rsync -av " . INSTALL_PATH . "$file $target_dir/$file")) {
- $err = true;
- break;
+
+ // remove old (<1.0) .htaccess file
+ @unlink("$target_dir/program/.htaccess");
+ echo "done.";
+
+ // Inform the user about .htaccess change
+ if (!empty($htaccess_copied)) {
+ if (file_get_contents("$target_dir/.htaccess") != file_get_contents("$target_dir/.htaccess.orig")) {
+ echo "\n!! Old .htaccess file saved as .htaccess.orig !!";
+ }
+ else {
+ @unlink("$target_dir/.htaccess.orig");
}
}
- // remove old (<1.0) .htaccess file
- @unlink("$target_dir/program/.htaccess");
- echo "done.\n\n";
+
+ echo "\n\n";
if (is_dir("$target_dir/skins/default")) {
echo "Removing old default skin...";
@@ -75,13 +99,27 @@
echo "done.\n\n";
}
- if (!$err) {
- echo "Running update script at target...\n";
- system("cd $target_dir && php bin/update.sh --version=$oldversion");
- echo "All done.\n";
+ // check if js-deps are up-to-date
+ if (file_exists("$target_dir/jsdeps.json") && file_exists("$target_dir/bin/install-jsdeps.sh")) {
+ $jsdeps = json_decode(file_get_contents("$target_dir/jsdeps.json"));
+ $package = $jsdeps->dependencies[0];
+ $dest_file = $target_dir . '/' . $package->dest;
+ if (!file_exists($dest_file) || sha1_file($dest_file) !== $package->sha1) {
+ echo "Installing JavaScript dependencies...";
+ system("cd $target_dir && bin/install-jsdeps.sh");
+ echo "done.\n\n";
+ }
}
+ else {
+ echo "JavaScript dependencies installation skipped...\n";
+ }
+
+ echo "Running update script at target...\n";
+ system("cd $target_dir && php bin/update.sh --version=$oldversion");
+ echo "All done.\n";
}
-else
+else {
echo "Update cancelled. See ya!\n";
+}
?>
diff -r 65fd7d441cf1 -r bf99236cc5cd bin/jsshrink.sh
--- a/bin/jsshrink.sh Sat Dec 29 06:32:49 2018 -0500
+++ b/bin/jsshrink.sh Sat Dec 29 07:07:34 2018 -0500
@@ -2,10 +2,8 @@
PWD=`dirname "$0"`
JS_DIR="$PWD/../program/js"
JAR_DIR='/tmp'
-LANG_IN='ECMASCRIPT3'
-# latest version requires Java 7, we'll use an older one
-#CLOSURE_COMPILER_URL='http://dl.google.com/closure-compiler/compiler-latest.zip'
-CLOSURE_COMPILER_URL='http://dl.google.com/closure-compiler/compiler-20131014.zip'
+LANG_IN='ECMASCRIPT5'
+CLOSURE_COMPILER_URL='http://dl.google.com/closure-compiler/compiler-latest.zip'
do_shrink() {
rm -f "$2"
@@ -39,7 +37,7 @@
echo "Please download $CLOSURE_COMPILER_URL and extract compiler.jar to $JAR_DIR/."
exit 1
fi
- (cd $JAR_DIR && unzip "/tmp/$$.zip" "compiler.jar")
+ (cd $JAR_DIR && unzip -p "/tmp/$$.zip" "*.jar" > "$JAR_DIR/compiler.jar")
rm -f "/tmp/$$.zip"
fi
@@ -58,7 +56,7 @@
exit
fi
-DIRS="$PWD/../program/js $PWD/../skins/* $PWD/../plugins/* $PWD/../plugins/*/skins/*"
+DIRS="$PWD/../program/js $PWD/../skins/* $PWD/../plugins/* $PWD/../plugins/*/skins/* $PWD/../plugins/managesieve/codemirror/lib"
# default: compress application scripts
for dir in $DIRS; do
for file in $dir/*.js; do
diff -r 65fd7d441cf1 -r bf99236cc5cd bin/moduserprefs.sh
--- a/bin/moduserprefs.sh Sat Dec 29 06:32:49 2018 -0500
+++ b/bin/moduserprefs.sh Sat Dec 29 07:07:34 2018 -0500
@@ -5,7 +5,7 @@
| bin/moduserprefs.sh |
| |
| This file is part of the Roundcube Webmail client |
- | Copyright (C) 2012, The Roundcube Dev Team |
+ | Copyright (C) 2012-2015, The Roundcube Dev Team |
| |
| Licensed under the GNU General Public License version 3 or |
| any later version with exceptions for skins & plugins. |
@@ -24,59 +24,45 @@
function print_usage()
{
- print "Usage: moduserprefs.sh [--user=user-id] pref-name [pref-value|--delete]\n";
- print "--user User ID in local database\n";
- print "--delete Unset the given preference\n";
+ print "Usage: moduserprefs.sh [options] pref-name [pref-value]\n";
+ print "Options:\n";
+ print " --user=user-id User ID in local database\n";
+ print " --config=path Location of additional configuration file\n";
+ print " --delete Unset the given preference\n";
+ print " --type=type Pref-value type: int, bool, string\n";
}
// get arguments
-$args = rcube_utils::get_opt(array('u' => 'user', 'd' => 'delete'));
+$args = rcube_utils::get_opt(array(
+ 'u' => 'user',
+ 'd' => 'delete:bool',
+ 't' => 'type',
+ 'c' => 'config',
+));
if ($_SERVER['argv'][1] == 'help') {
- print_usage();
- exit;
+ print_usage();
+ exit;
}
-else if (empty($args[0]) || (!isset($args[1]) && !$args['delete'])) {
- print "Missing required parameters.\n";
- print_usage();
- exit;
+else if (empty($args[0]) || (empty($args[1]) && empty($args['delete']))) {
+ print "Missing required parameters.\n";
+ print_usage();
+ exit;
}
$pref_name = trim($args[0]);
$pref_value = $args['delete'] ? null : trim($args[1]);
-// connect to DB
-$rcmail = rcube::get_instance();
-
-$db = $rcmail->get_dbh();
-$db->db_connect('w');
-
-if (!$db->is_connected() || $db->is_error())
- die("No DB connection\n" . $db->is_error());
-
-$query = '1=1';
-
-if ($args['user'])
- $query = '`user_id` = ' . intval($args['user']);
-
-// iterate over all users
-$sql_result = $db->query("SELECT * FROM " . $db->table_name('users', true) . " WHERE $query");
-while ($sql_result && ($sql_arr = $db->fetch_assoc($sql_result))) {
- echo "Updating prefs for user " . $sql_arr['user_id'] . "...";
-
- $user = new rcube_user($sql_arr['user_id'], $sql_arr);
- $prefs = $old_prefs = $user->get_prefs();
-
- $prefs[$pref_name] = $pref_value;
-
- if ($prefs != $old_prefs) {
- $user->save_prefs($prefs, true);
- echo "saved.\n";
- }
- else {
- echo "nothing changed.\n";
- }
+if ($pref_value === null) {
+ $args['type'] = null;
}
+if ($args['config']) {
+ $rcube = rcube::get_instance();
+ $rcube->config->load_from_file($args['config']);
+}
+
+rcmail_utils::mod_pref($pref_name, $pref_value, $args['user'], $args['type']);
+
?>
diff -r 65fd7d441cf1 -r bf99236cc5cd bin/update.sh
--- a/bin/update.sh Sat Dec 29 06:32:49 2018 -0500
+++ b/bin/update.sh Sat Dec 29 07:07:34 2018 -0500
@@ -18,20 +18,13 @@
| Author: Thomas Bruederli Checking PHP version
=')) {
- if (PHP_MAJOR_VERSION != 5) {
- $RCI->fail('Version', 'PHP5 is required, ' . PHP_VERSION . ' detected');
- }
- else {
- $RCI->pass('Version', 'PHP ' . PHP_VERSION . ' detected');
- }
-}
-else {
+ $RCI->pass('Version', 'PHP ' . PHP_VERSION . ' detected');
+} else {
$RCI->fail('Version', 'PHP Version ' . MIN_PHP_VERSION . ' or greater is required ' . PHP_VERSION . ' detected');
}
?>
diff -r 65fd7d441cf1 -r bf99236cc5cd installer/client.js
--- a/installer/client.js Sat Dec 29 06:32:49 2018 -0500
+++ b/installer/client.js Sat Dec 29 07:07:34 2018 -0500
@@ -1,6 +1,6 @@
/*
+-----------------------------------------------------------------------+
- | Roundcube installer cleint function |
+ | Roundcube installer client function |
| |
| This file is part of the Roundcube web development suite |
| Copyright (C) 2009-2012, The Roundcube Dev Team |
diff -r 65fd7d441cf1 -r bf99236cc5cd installer/config.php
--- a/installer/config.php Sat Dec 29 06:32:49 2018 -0500
+++ b/installer/config.php Sat Dec 29 07:07:34 2018 -0500
@@ -4,11 +4,6 @@
die("Not allowed! Please open installer/index.php instead.");
}
-?>
-
Copy or download the following configuration and save it';
echo ' as config.inc.php within the '.RCUBE_CONFIG_DIR.' directory of your Roundcube installation.
';
echo ' Make sure that there are no characters outside the <?php ?> brackets when saving the file.';
echo ' ';
+ echo $save_button;
if ($RCI->legacy_config) {
echo '
Afterwards, please remove the old configuration files main.inc.php and db.inc.php from the config directory.';
@@ -52,7 +56,7 @@
}
echo '
Of course there are more options to configure. - Have a look at the defaults.inc.php file or visit Howto_Config to find out.
'; + Have a look at the defaults.inc.php file or visit Howto_Config to find out.'; echo ''; @@ -61,6 +65,9 @@ } ?> +