<ahref="http://www.iredmail.org"target="_blank">iRedMail web site</a>
// <ahref="./index.html">Document Index</a>
</div><h1id="upgrade-iredmail-from-073-to-074">Upgrade iRedMail from 0.7.3 to 0.7.4</h1>
<divclass="toc">
<ul>
<li><ahref="#upgrade-iredmail-from-073-to-074">Upgrade iRedMail from 0.7.3 to 0.7.4</a><ul>
<li><ahref="#general-all-backends-should-apply-these-upgrade-steps">General (All backends should apply these upgrade steps)</a><ul>
<li><ahref="#fix-incorrect-per-user-sieve_dir-setting-in-dovecot">Fix incorrect per-user sieve_dir setting in Dovecot</a></li>
<li><ahref="#add-indexes-for-amavisd-database">Add indexes for Amavisd database</a></li>
<li><ahref="#debian-and-ubuntu-special-assign-apache-daemon-user-to-group-adm">[Debian and Ubuntu special] Assign Apache daemon user to group adm</a></li>
<h2id="general-all-backends-should-apply-these-upgrade-steps">General (All backends should apply these upgrade steps)</h2>
<h3id="fix-incorrect-per-user-sieve_dir-setting-in-dovecot">Fix incorrect per-user sieve_dir setting in Dovecot</h3>
<p><strong>Note</strong>: This fix is applicable to Dovecot-1.x, you can check Dovecot version
with command <code>dovecot -n</code>.</p>
<p>In <code>/etc/dovecot.conf</code> or <code>/etc/dovecot/dovecot.conf</code>, remove the last slash
(<code>/</code>) in setting <code>sieve_dir =</code> like below:</p>
<pre><code># Part of file: dovecot.conf
# Original setting:
#sieve_dir = /var/vmail/sieve/%Ld/%Ln/
# Change to:
sieve_dir = /var/vmail/sieve/%Ld/%Ln # <-- Remove the last slash.
</code></pre>
<h3id="add-indexes-for-amavisd-database">Add indexes for Amavisd database</h3>
<pre><code>$ mysql -uroot -p
mysql> USE amavisd;
mysql> ALTER TABLE maddr ADD INDEX maddr_idx_email (email);
mysql> ALTER TABLE maddr ADD INDEX maddr_idx_domain (domain);
mysql> ALTER TABLE msgs ADD INDEX msgs_idx_content (content);
mysql> ALTER TABLE msgs ADD INDEX msgs_idx_content_time_num (content, time_num);
mysql> ALTER TABLE msgs ADD INDEX msgs_idx_mail_id (mail_id);
mysql> ALTER TABLE quarantine ADD INDEX quar_idx_mail_id (mail_id);
</code></pre>
<h3id="debian-and-ubuntu-special-assign-apache-daemon-user-to-group-adm">[Debian and Ubuntu special] Assign Apache daemon user to group <code>adm</code></h3>
<p><strong>Note</strong>: This fix is applicable to only Debian and Ubuntu.</p>
<p>Assign Apache daemon user to group <code>adm</code> to avoid Awstats cron job issue.</p>
<h3id="store-realtime-mailbox-quota-usage-in-seperate-sql-table">Store realtime mailbox quota usage in seperate SQL table</h3>
<p>In iRedMail-0.7.3 and some earlier versions, Dovecot stores realtime mailbox
quota usage in MySQL database in two columns: <code>mailbox.bytes</code>,
<code>mailbox.messages</code>, if they have invalid values (e.g. empty value, non-integer
value), Dovecot will update them with two SQL commands:</p>
<ol>
<li>delete record with SQL: <code>DELETE FROM mailbox WHERE username='xxx@yyy.com'</code></li>
<li>create a new record with current, correct quota info. SQL: <code>INSERT INTO mailbox (username, bytes, messages) VALUES ('xxx@yyy.com', xx, xx)</code></li>
</ol>
<p>As you can see, first sql command will delete iRedMail mail user, that's
critial issue. So we have to store realtime mailbox quota usage in a separate
MySQL table to avoid similar issues.</p>
<p>Below are steps to store realtime mailbox quota usage in a separate SQL table:</p>
<ul>
<li>Create new SQL table <code>vmail.used_quota</code> to store mailbox quota:</li>
</ul>
<pre><code># mysql -uroot -p
mysql> USE vmail;
mysql> 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;
</code></pre>
<ul>
<li>
<p>Replace <code>table = mailbox</code> with <code>table = used_quota</code> in below config file,
so that Dovecot will store mailbox quota in new SQL table. </p>
<ul>
<li>On RHEL/CentOS/Scientific Linux 5.x, please update <code>/etc/dovecot-used-quota.conf</code>, on 6.x, please update <code>/etc/dovecot/used-quota.conf</code>.</li>
</ul><pstyle="text-align: center; color: grey;">Document published under a <ahref="http://creativecommons.org/licenses/by-nd/3.0/us/"target="_blank">CC BY-ND 3.0</a> license. If you found something wrong, please do <ahref="http://www.iredmail.org/contact.html">contact us</a> to fix it.<script>