From abd475b46d1196f0fb28dfbdf9e1dc3615c89f82 Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Sun, 13 Feb 2011 12:45:23 +0000 Subject: [PATCH] Fix MySQL indexes if upgrading from 0.5-2 or lesser. Closes: #610725. --- debian/changelog | 1 + debian/roundcube-core.postinst | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/debian/changelog b/debian/changelog index 0aa6e75..c5004c8 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,7 @@ roundcube (0.5-3) UNRELEASED; urgency=low * Add instructions on how to install and upgrade when not using dbconfig-common. We do not ship UPGRADING file any more since it is misleading. Closes: #612511. + * Fix MySQL indexes if upgrading from 0.5-2 or lesser. Closes: #610725. -- Vincent Bernat Wed, 09 Feb 2011 07:32:42 +0100 diff --git a/debian/roundcube-core.postinst b/debian/roundcube-core.postinst index c1968a6..f4e2a82 100644 --- a/debian/roundcube-core.postinst +++ b/debian/roundcube-core.postinst @@ -39,6 +39,27 @@ apache_install() { case "$1" in configure) + # We try to fix an incomplete upgrade (see #610725) + if [ -n "$2" ] && dpkg --compare-versions "$2" le 0.5-2; then + db_get roundcube/dbconfig-upgrade || true + if [ x"$RET" = x"true" ]; then + # Ok, we may need to do some upgrade steps. Let's get + # database parameters + eval `sed -n 's/^\$\(.*\);$/\1/p' /etc/roundcube/debian-db.php` + if [ x"$dbtype" = x"mysql" ]; then + echo "Fixing MySQL indexes (you can ignore errors)..." + MYSQLARGS="-f -u $dbuser -p$dbpass $dbname" + [ -z "$dbserver" ] || MYSQLARGS="-h $dbserver $MYSQLARGS" + [ -z "$dbport" ] || MYSQLARGS="-P $dbport $MYSQLARGS" + cat <