diff -Nur -x '*.orig' -x '*.rej' e-smith-horde-1.13.0/createlinks mezzanine_patched_e-smith-horde-1.13.0/createlinks --- e-smith-horde-1.13.0/createlinks 2006-12-23 17:47:27.000000000 -0600 +++ mezzanine_patched_e-smith-horde-1.13.0/createlinks 2006-12-23 17:34:11.000000000 -0600 @@ -49,6 +49,7 @@ 40horde_mysql_create_indexes 50horde-2.2_to_3.0 55horde-3.0_to_3.1 + 56horde-3.1_alter_table 77mysql_update_privs )) { @@ -71,6 +72,7 @@ 40horde_mysql_create_indexes 50horde-2.2_to_3.0 55horde-3.0_to_3.1 + 56horde-3.1_alter_table 77mysql_update_privs )) { diff -Nur -x '*.orig' -x '*.rej' e-smith-horde-1.13.0/root/etc/e-smith/events/actions/horde_alter_table mezzanine_patched_e-smith-horde-1.13.0/root/etc/e-smith/events/actions/horde_alter_table --- e-smith-horde-1.13.0/root/etc/e-smith/events/actions/horde_alter_table 1969-12-31 18:00:00.000000000 -0600 +++ mezzanine_patched_e-smith-horde-1.13.0/root/etc/e-smith/events/actions/horde_alter_table 2006-12-23 17:41:31.000000000 -0600 @@ -0,0 +1,76 @@ +#!/usr/bin/perl -w +#---------------------------------------------------------------------- +# copyright (C) 2002-2005 Mitel Networks Corporation +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# Technical support for this program is available from Mitel Networks +# Please visit our web site www.mitel.com/sme/ for details. +#---------------------------------------------------------------------- + +use strict; +use DBI; +use esmith::ConfigDB; +use esmith::util; + +# Exit early if there is nothing to do +die("horde db must exist") unless ( -d "/var/lib/mysql/horde/"); +die("horde_user db must exist") unless ( -f "/var/lib/mysql/horde/horde_users.frm"); + + +# This is a translation of the script 'mysql_upgrade_1.1_to_1.2.sql +# that is safe to run multiple times, and which can be run on a 1.2 +# installation without barfing. +# Modified 12-23-06 by John H. Bennett III to accommodate the table alteration required +# for upgrades from horde 2.x or 3.0 to 3.1 + +my $conf = esmith::ConfigDB->open_ro + or die "Can't open configuration database: $!\n"; +our $username = 'root'; +our $password = esmith::util::LdapPassword(); +our $HORDE_DATABASE = 'horde'; +our $dbi_options = {RaiseError => 1, ChopBlanks => 1, AutoCommit => 1}; + +my $db_hordehandle = DBI->connect + ("DBI:mysql:$HORDE_DATABASE", + $username, $password, $dbi_options ) + || die ("Connection error: $DBI::errstr"); + + +# We now need to create some columns, but we need to first check +# whether they exist already +my $sth = $db_hordehandle->prepare("show columns from horde_users"); +$sth->execute; +my $horde_users = $sth->fetchall_hashref('Field'); + +unless (defined $horde_users->{user_soft_expiration_date}) +{ + # We need to be careful about this one as it will fail if the + # column exists, so we check the error. + my $statement = 'ALTER TABLE horde_users ADD COLUMN user_soft_expiration_date INT'; + $statement = $db_hordehandle->prepare($statement) or + die "prepare: $$statement: $DBI::errstr"; + $statement->execute or die "execute: $$statement: $DBI::errstr"; +} + +unless (defined $horde_users->{user_hard_expiration_date}) +{ + # We need to be careful about this one too + my $statement = 'ALTER TABLE horde_users ADD COLUMN user_hard_expiration_date INT'; + $statement = $db_hordehandle->prepare($statement) or + die "prepare: $$statement: $DBI::errstr"; + $statement->execute or die "execute: $$statement: $DBI::errstr"; +} + diff -Nur -x '*.orig' -x '*.rej' e-smith-horde-1.13.0/root/etc/e-smith/templates/etc/e-smith/sql/init/55horde-3.0_to_3.1 mezzanine_patched_e-smith-horde-1.13.0/root/etc/e-smith/templates/etc/e-smith/sql/init/55horde-3.0_to_3.1 --- e-smith-horde-1.13.0/root/etc/e-smith/templates/etc/e-smith/sql/init/55horde-3.0_to_3.1 2006-12-23 17:47:27.000000000 -0600 +++ mezzanine_patched_e-smith-horde-1.13.0/root/etc/e-smith/templates/etc/e-smith/sql/init/55horde-3.0_to_3.1 2006-12-23 17:35:33.000000000 -0600 @@ -1,4 +1,4 @@ #! /bin/sh test -f /var/lib/mysql/horde/horde_histories.frm && exit 0 -exec mysql horde < /home/httpd/html/horde/scripts/upgrades/3.0_to_3.1.mysql.sql +exec mysql horde < /home/httpd/html/horde/scripts/db/mysql_horde3.0_to_3.1.sql diff -Nur -x '*.orig' -x '*.rej' e-smith-horde-1.13.0/root/etc/e-smith/templates/etc/e-smith/sql/init/56horde-3.1_alter_table mezzanine_patched_e-smith-horde-1.13.0/root/etc/e-smith/templates/etc/e-smith/sql/init/56horde-3.1_alter_table --- e-smith-horde-1.13.0/root/etc/e-smith/templates/etc/e-smith/sql/init/56horde-3.1_alter_table 1969-12-31 18:00:00.000000000 -0600 +++ mezzanine_patched_e-smith-horde-1.13.0/root/etc/e-smith/templates/etc/e-smith/sql/init/56horde-3.1_alter_table 2006-12-23 17:34:53.000000000 -0600 @@ -0,0 +1,2 @@ +#! /bin/sh +exec /etc/e-smith/events/actions/horde_alter_table diff -Nur -x '*.orig' -x '*.rej' e-smith-horde-1.13.0/root/etc/e-smith/templates.metadata/etc/e-smith/sql/init/56horde-3.1_alter_table mezzanine_patched_e-smith-horde-1.13.0/root/etc/e-smith/templates.metadata/etc/e-smith/sql/init/56horde-3.1_alter_table --- e-smith-horde-1.13.0/root/etc/e-smith/templates.metadata/etc/e-smith/sql/init/56horde-3.1_alter_table 1969-12-31 18:00:00.000000000 -0600 +++ mezzanine_patched_e-smith-horde-1.13.0/root/etc/e-smith/templates.metadata/etc/e-smith/sql/init/56horde-3.1_alter_table 2006-12-23 17:37:52.000000000 -0600 @@ -0,0 +1 @@ +PERMS=0544 diff -Nur -x '*.orig' -x '*.rej' e-smith-horde-1.13.0/root/home/httpd/html/horde/scripts/db/mysql_horde3.0_to_3.1.sql mezzanine_patched_e-smith-horde-1.13.0/root/home/httpd/html/horde/scripts/db/mysql_horde3.0_to_3.1.sql --- e-smith-horde-1.13.0/root/home/httpd/html/horde/scripts/db/mysql_horde3.0_to_3.1.sql 1969-12-31 18:00:00.000000000 -0600 +++ mezzanine_patched_e-smith-horde-1.13.0/root/home/httpd/html/horde/scripts/db/mysql_horde3.0_to_3.1.sql 2006-12-23 17:45:24.000000000 -0600 @@ -0,0 +1,17 @@ +CREATE TABLE IF NOT EXISTS horde_histories ( + history_id BIGINT NOT NULL, + object_uid VARCHAR(255) NOT NULL, + history_action VARCHAR(32) NOT NULL, + history_ts BIGINT NOT NULL, + history_desc TEXT, + history_who VARCHAR(255), + history_extra TEXT, +-- + PRIMARY KEY (history_id) +); + +CREATE INDEX history_action_idx ON horde_histories (history_action); +CREATE INDEX history_ts_idx ON horde_histories (history_ts); +CREATE INDEX history_uid_idx ON horde_histories (object_uid); + +GRANT SELECT, INSERT, UPDATE, DELETE ON horde_histories TO horde@localhost;