/[smeserver]/rpms/e-smith-horde/sme8/e-smith-horde-1.13.0-17.horde_create_indexes_2.patch
ViewVC logotype

Contents of /rpms/e-smith-horde/sme8/e-smith-horde-1.13.0-17.horde_create_indexes_2.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (show annotations) (download)
Thu Jun 26 04:27:31 2008 UTC (15 years, 11 months ago) by slords
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +0 -0 lines
FILE REMOVED
* Tue Jun 24 2008 John H. Bennett III <bennettj@johnbennettservices.com> 3.2-2
- Upgrade patch for Horde 3.2.1

1 diff -Nur -x '*.orig' -x '*.rej' e-smith-horde-1.13.0/root/etc/e-smith/events/actions/horde_create_indexes mezzanine_patched_e-smith-horde-1.13.0/root/etc/e-smith/events/actions/horde_create_indexes
2 --- e-smith-horde-1.13.0/root/etc/e-smith/events/actions/horde_create_indexes 1969-12-31 18:00:00.000000000 -0600
3 +++ mezzanine_patched_e-smith-horde-1.13.0/root/etc/e-smith/events/actions/horde_create_indexes 2006-12-27 01:22:35.000000000 -0600
4 @@ -0,0 +1,121 @@
5 +#!/usr/bin/perl -w
6 +#----------------------------------------------------------------------
7 +# copyright (C) 2002-2005 Mitel Networks Corporation
8 +#
9 +# This program is free software; you can redistribute it and/or modify
10 +# it under the terms of the GNU General Public License as published by
11 +# the Free Software Foundation; either version 2 of the License, or
12 +# (at your option) any later version.
13 +#
14 +# This program is distributed in the hope that it will be useful,
15 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
16 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 +# GNU General Public License for more details.
18 +#
19 +# You should have received a copy of the GNU General Public License
20 +# along with this program; if not, write to the Free Software
21 +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 +#
23 +# Technical support for this program is available from Mitel Networks
24 +# Please visit our web site www.mitel.com/sme/ for details.
25 +#----------------------------------------------------------------------
26 +
27 +use strict;
28 +use DBI;
29 +use esmith::ConfigDB;
30 +use esmith::util;
31 +
32 +# Exit early if there is nothing to do
33 +die("horde db must exist") unless ( -d "/var/lib/mysql/horde/");
34 +die("horde_prefs db must exist") unless ( -f "/var/lib/mysql/horde/horde_prefs.frm");
35 +die("horde_categories db must exist") unless ( -f "/var/lib/mysql/horde/horde_categories.frm");
36 +
37 +
38 +# This is a translation of the script 'mysql_upgrade_1.1_to_1.2.sql
39 +# that is safe to run multiple times, and which can be run on a 1.2
40 +# installation without barfing.
41 +# Modified 12-27-06 by John H. Bennett III to accommodate the creation of some horde indexes.
42 +
43 +my $conf = esmith::ConfigDB->open_ro
44 + or die "Can't open configuration database: $!\n";
45 +our $username = 'root';
46 +our $password = esmith::util::LdapPassword();
47 +our $HORDE_DATABASE = 'horde';
48 +our $dbi_options = {RaiseError => 1, ChopBlanks => 1, AutoCommit => 1};
49 +
50 +my $db_hordehandle = DBI->connect
51 + ("DBI:mysql:$HORDE_DATABASE",
52 + $username, $password, $dbi_options )
53 + || die ("Connection error: $DBI::errstr");
54 +
55 +
56 +# We now need to create some columns, but we need to first check
57 +# whether they exist already
58 +my $sth = $db_hordehandle->prepare("show index from horde_prefs");
59 +$sth->execute;
60 +my $horde_prefs = $sth->fetchall_hashref('Key_name');
61 +
62 +my $sth1 = $db_hordehandle->prepare("show columns from horde_categories");
63 +$sth1->execute;
64 +my $horde_categories = $sth1->fetchall_hashref('Field');
65 +
66 +#Create an index for pref_uid if needed
67 +unless (defined $horde_prefs->{pref_uid_idx})
68 +{
69 + my $statement = 'alter table horde_prefs ' .
70 + 'add index pref_uid_idx (pref_uid)';
71 + $statement = $db_hordehandle->prepare($statement) or
72 + die "prepare: $$statement: $DBI::errstr";
73 + $statement->execute or die "execute: $$statement: $DBI::errstr";
74 +}
75 +
76 +# Create an index for pref_scope if needed
77 +unless (defined $horde_prefs->{pref_scope_idx})
78 +{
79 + my $statement = 'alter table horde_prefs ' .
80 + 'add index pref_scope_idx (pref_scope)';
81 + $statement = $db_hordehandle->prepare($statement) or
82 + die "prepare: $$statement: $DBI::errstr";
83 + $statement->execute or die "execute: $$statement: $DBI::errstr";
84 +}
85 +
86 +# Create an index for category_name if needed
87 +unless ($horde_categories->{category_name}->{Key})
88 +{
89 + my $statement = 'alter table horde_categories ' .
90 + 'add index category_category_name_idx (category_name)';
91 + $statement = $db_hordehandle->prepare($statement) or
92 + die "prepare: $$statement: $DBI::errstr";
93 + $statement->execute or die "execute: $$statement: $DBI::errstr";
94 +}
95 +
96 +# Create an index for group_uid if needed
97 +unless ($horde_categories->{group_uid}->{Key})
98 +{
99 + my $statement = 'alter table horde_categories ' .
100 + 'add index category_group_idx (group_uid)';
101 + $statement = $db_hordehandle->prepare($statement) or
102 + die "prepare: $$statement: $DBI::errstr";
103 + $statement->execute or die "execute: $$statement: $DBI::errstr";
104 +}
105 +
106 +# Create an index for user_uid if needed
107 +unless ($horde_categories->{user_uid}->{Key})
108 +{
109 + my $statement = 'alter table horde_categories ' .
110 + 'add index category_user_idx (user_uid)';
111 + $statement = $db_hordehandle->prepare($statement) or
112 + die "prepare: $$statement: $DBI::errstr";
113 + $statement->execute or die "execute: $$statement: $DBI::errstr";
114 +}
115 +
116 +# Create an index for category_serialized if needed
117 +unless ($horde_categories->{category_serialized}->{Key})
118 +{
119 + my $statement = 'alter table horde_categories ' .
120 + 'add index category_serialized_idx (category_serialized)';
121 + $statement = $db_hordehandle->prepare($statement) or
122 + die "prepare: $$statement: $DBI::errstr";
123 + $statement->execute or die "execute: $$statement: $DBI::errstr";
124 +}
125 +
126 diff -Nur -x '*.orig' -x '*.rej' e-smith-horde-1.13.0/root/etc/e-smith/templates/etc/e-smith/sql/init/40horde_mysql_create_indexes mezzanine_patched_e-smith-horde-1.13.0/root/etc/e-smith/templates/etc/e-smith/sql/init/40horde_mysql_create_indexes
127 --- e-smith-horde-1.13.0/root/etc/e-smith/templates/etc/e-smith/sql/init/40horde_mysql_create_indexes 2006-12-27 01:38:31.000000000 -0600
128 +++ mezzanine_patched_e-smith-horde-1.13.0/root/etc/e-smith/templates/etc/e-smith/sql/init/40horde_mysql_create_indexes 2006-12-27 01:32:17.000000000 -0600
129 @@ -1,4 +1,3 @@
130 #! /bin/sh
131
132 -test -f /var/lib/mysql/horde/horde_histories.frm && exit 0
133 -exec mysql < /home/httpd/html/horde/scripts/db/mysql_create_indexes.sql
134 +exec /etc/e-smith/events/actions/horde_create_indexes

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed