Commits

Zhang Huangbin  committed a33942a

Reverse commit to r43: Store realtime mailbox quota in separate SQL table in MySQL backend.

  • Participants
  • Parent commits eea1bd7

Comments (0)

Files changed (5)

File iRedMail/ChangeLog

 iRedMail-0.7.4:
+    * Store realtime mailbox quota in separate SQL table in MySQL backend.
     * It now works on Ubuntu 11.10, openSUSE 12.1.
     * SPF verification is now enabled by default.
     * Add Policyd-2.0.x (code name "cluebringer") support on Ubuntu 11.10.

File iRedMail/conf/dovecot

 # Dovecot quota warning.
 export DOVECOT_QUOTA_WARNING_SCRIPT='/usr/local/bin/dovecot-quota-warning.sh'
 export DOVECOT_REALTIME_QUOTA_SQLTYPE='mysql'
+export DOVECOT_REALTIME_QUOTA_TABLE='used_quota'
 export DOVECOT_SHARE_FOLDER_SQLTYPE='mysql'
 
 if [ X"${DOVECOT_VERSION}" == X"1.1" -o X"${DOVECOT_VERSION}" == X"1.2" ]; then

File iRedMail/functions/dovecot1.sh

 
         if [ X"${BACKEND}" == X"OpenLDAP" ]; then
             realtime_quota_db_name="${IREDADMIN_DB_NAME}"
-            realtime_quota_db_table="used_quota"
             realtime_quota_db_user="${IREDADMIN_DB_USER}"
             realtime_quota_db_passwd="${IREDADMIN_DB_PASSWD}"
         else
             realtime_quota_db_name="${VMAIL_DB}"
-            realtime_quota_db_table="mailbox"
             realtime_quota_db_user="${MYSQL_ADMIN_USER}"
             realtime_quota_db_passwd="${MYSQL_ADMIN_PW}"
         fi
 connect = host=${MYSQL_SERVER} dbname=${realtime_quota_db_name} user=${realtime_quota_db_user} password=${realtime_quota_db_passwd}
 map {
     pattern = priv/quota/storage
-    table = ${realtime_quota_db_table}
+    table = ${DOVECOT_REALTIME_QUOTA_TABLE}
     username_field = username
     value_field = bytes
 }
 map {
     pattern = priv/quota/messages
-    table = ${realtime_quota_db_table}
+    table = ${DOVECOT_REALTIME_QUOTA_TABLE}
     username_field = username
     value_field = messages
 }

File iRedMail/functions/dovecot2.sh

 
         if [ X"${BACKEND}" == X"OpenLDAP" ]; then
             realtime_quota_db_name="${IREDADMIN_DB_NAME}"
-            realtime_quota_db_table="used_quota"
             realtime_quota_db_user="${IREDADMIN_DB_USER}"
             realtime_quota_db_passwd="${IREDADMIN_DB_PASSWD}"
         else
             realtime_quota_db_name="${VMAIL_DB}"
-            realtime_quota_db_table="mailbox"
             realtime_quota_db_user="${MYSQL_ADMIN_USER}"
             realtime_quota_db_passwd="${MYSQL_ADMIN_PW}"
         fi
 connect = host=${MYSQL_SERVER} dbname=${realtime_quota_db_name} user=${realtime_quota_db_user} password=${realtime_quota_db_passwd}
 map {
     pattern = priv/quota/storage
-    table = ${realtime_quota_db_table}
+    table = ${DOVECOT_REALTIME_QUOTA_TABLE}
     username_field = username
     value_field = bytes
 }
 map {
     pattern = priv/quota/messages
-    table = ${realtime_quota_db_table}
+    table = ${DOVECOT_REALTIME_QUOTA_TABLE}
     username_field = username
     value_field = messages
 }

File iRedMail/samples/iredmail.sql

     INDEX (from_user),
     INDEX (to_user)
 );
+
+#
+# Table `used_quota`. Used to store realtime mailbox quota in Dovecot.
+#
+# WARNING:
+#   - Works only with Dovecot 1.2+.
+#
+CREATE TABLE IF NOT EXISTS `used_quota` (
+    `username` VARCHAR(255) NOT NULL,
+    `bytes` BIGINT NOT NULL DEFAULT 0,
+    `messages` BIGINT NOT NULL DEFAULT 0,
+    PRIMARY KEY (`username`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;