// <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>
<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>
<pstyle="text-align: center; color: grey;">All documents are available in <ahref="https://bitbucket.org/zhb/iredmail-docs/src">BitBucket repository</a>, and published under <ahref="http://creativecommons.org/licenses/by-nd/3.0/us/"target="_blank">Creative Commons</a> license. You can <ahref="https://bitbucket.org/zhb/iredmail-docs/get/tip.tar.bz2">download the latest version</a> for offline reading. If you found something wrong, please do <ahref="http://www.iredmail.org/contact.html">contact us</a> to fix it.</p>