From 58a4e6bbebf5a7b0f6cbb7082252b56a04eb19de Mon Sep 17 00:00:00 2001 From: Florent Bruneau Date: Sun, 28 Dec 2008 21:27:25 +0100 Subject: [PATCH] mail_storage. Signed-off-by: Florent Bruneau --- include/emails.inc.php | 14 +++++++------- upgrade/account/05_emails.sql | 8 ++++++++ upgrade/account/99_insertion.sql | 5 +++++ upgrade/account/README | 1 + 4 files changed, 21 insertions(+), 7 deletions(-) create mode 100644 upgrade/account/05_emails.sql diff --git a/include/emails.inc.php b/include/emails.inc.php index db87791..432b485 100644 --- a/include/emails.inc.php +++ b/include/emails.inc.php @@ -299,18 +299,18 @@ class EmailStorage extends Email // Retrieves the current list of actives storages. private function get_storages() { - $res = XDB::query("SELECT mail_storage - FROM auth_user_md5 - WHERE user_id = {?}", $this->user->id()); - return new PlFlagSet($res->fetchOneCell()); + return new PlFlagSet(XDB::fetchOneCell('SELECT storage + FROM email_options + WHERE uid = {?}', + $this->user->id())); } // Updates the list of active storages. private function set_storages($storages) { - XDB::execute("UPDATE auth_user_md5 - SET mail_storage = {?} - WHERE user_id = {?}", $storages, $this->user->id()); + XDB::execute("UPDATE email_options + SET storage = {?} + WHERE uid = {?}", $storages, $this->user->id()); } // Returns the list of allowed storages for the @p user. diff --git a/upgrade/account/05_emails.sql b/upgrade/account/05_emails.sql new file mode 100644 index 0000000..c8df1a1 --- /dev/null +++ b/upgrade/account/05_emails.sql @@ -0,0 +1,8 @@ +create table email_options ( + uid int(6) not null, + storage set('imap', 'googleapps') not null default '', + + primary key uid (uid) +); + +# vim:set syntax=mysql: diff --git a/upgrade/account/99_insertion.sql b/upgrade/account/99_insertion.sql index 1b1d464..0f2a2dc 100644 --- a/upgrade/account/99_insertion.sql +++ b/upgrade/account/99_insertion.sql @@ -58,4 +58,9 @@ insert ignore into forum_profiles (uid, last_seen) from auth_user_quick where banana_last >= DATE_SUB(NOW(), INTERVAL 6 MONTH); +# Mail storage has been moved out of account settings +insert into email_options + select user_id as uid, mail_storage as storage + from auth_user_md5; + # vim:set syntax=mysql: diff --git a/upgrade/account/README b/upgrade/account/README index fc9da52..8ab4c37 100644 --- a/upgrade/account/README +++ b/upgrade/account/README @@ -21,3 +21,4 @@ News: Email: * auth_user_md5.smtppass -> accounts.weak_password. This password is NULL when empty, but a check must be added for empty passwords. +* auth_user_md5.mail_storage -> email_options.storage -- 2.1.4