1 |
mrjhb3 |
1.1 |
diff -Nur -x '*.orig' -x '*.rej' e-smith-turba-3.0.0/createlinks mezzanine_patched_e-smith-turba-3.0.0/createlinks |
2 |
|
|
--- e-smith-turba-3.0.0/createlinks 2008-10-07 12:37:45.000000000 -0500 |
3 |
|
|
+++ mezzanine_patched_e-smith-turba-3.0.0/createlinks 2009-04-07 21:51:02.000000000 -0500 |
4 |
|
|
@@ -14,12 +14,6 @@ |
5 |
|
|
qw(email-update bootstrap-console-save)); |
6 |
|
|
} |
7 |
|
|
|
8 |
|
|
-foreach (qw(smeserver_2.1_to_2.2_sql_schema.php)) |
9 |
|
|
-{ |
10 |
|
|
- templates2events("/home/httpd/html/horde/turba/scripts/upgrades/$_", |
11 |
|
|
- qw(bootstrap-console-save)); |
12 |
|
|
-} |
13 |
|
|
- |
14 |
|
|
foreach (qw(conf.php prefs.php sources.php)) |
15 |
|
|
{ |
16 |
|
|
safe_symlink("/etc/e-smith/templates-default/template-begin-php", |
17 |
|
|
@@ -28,14 +22,6 @@ |
18 |
|
|
"root/etc/e-smith/templates/home/httpd/html/horde/turba/config/$_/template-end"); |
19 |
|
|
} |
20 |
|
|
|
21 |
|
|
-foreach (qw(smeserver_2.1_to_2.2_sql_schema.php)) |
22 |
|
|
-{ |
23 |
|
|
- safe_symlink("/etc/e-smith/templates-default/template-begin-php", |
24 |
|
|
- "root/etc/e-smith/templates/home/httpd/html/horde/turba/scripts/upgrades/$_/template-begin"); |
25 |
|
|
- safe_symlink("/etc/e-smith/templates-default/template-end-php", |
26 |
|
|
- "root/etc/e-smith/templates/home/httpd/html/horde/turba/scripts/upgrades/$_/template-end"); |
27 |
|
|
-} |
28 |
|
|
- |
29 |
|
|
foreach (qw( |
30 |
|
|
40mysql.create.turba |
31 |
|
|
50turba_upgrade |
32 |
|
|
@@ -50,7 +36,6 @@ |
33 |
|
|
|
34 |
|
|
foreach (qw( |
35 |
|
|
40mysql.create.turba |
36 |
|
|
- 49turba_migrate_contacts |
37 |
|
|
50turba_upgrade |
38 |
|
|
57turba_mysql_reset_addressbook_pref |
39 |
|
|
60migrate-imp-to-turba |
40 |
|
|
diff -Nur -x '*.orig' -x '*.rej' e-smith-turba-3.0.0/root/etc/e-smith/templates/etc/e-smith/sql/init/49turba_migrate_contacts mezzanine_patched_e-smith-turba-3.0.0/root/etc/e-smith/templates/etc/e-smith/sql/init/49turba_migrate_contacts |
41 |
|
|
--- e-smith-turba-3.0.0/root/etc/e-smith/templates/etc/e-smith/sql/init/49turba_migrate_contacts 2008-06-20 22:19:38.000000000 -0500 |
42 |
|
|
+++ mezzanine_patched_e-smith-turba-3.0.0/root/etc/e-smith/templates/etc/e-smith/sql/init/49turba_migrate_contacts 1969-12-31 18:00:00.000000000 -0600 |
43 |
|
|
@@ -1,3 +0,0 @@ |
44 |
|
|
-#! /bin/sh |
45 |
|
|
-test -f /var/lib/mysql/horde/ingo_shares.frm && exit 0 |
46 |
|
|
-exec /usr/bin/php -q /home/httpd/html/horde/turba/scripts/upgrades/smeserver_2.1_to_2.2_sql_schema.php |
47 |
|
|
diff -Nur -x '*.orig' -x '*.rej' e-smith-turba-3.0.0/root/etc/e-smith/templates/home/httpd/html/horde/turba/config/sources.php/40LocalSQL mezzanine_patched_e-smith-turba-3.0.0/root/etc/e-smith/templates/home/httpd/html/horde/turba/config/sources.php/40LocalSQL |
48 |
|
|
--- e-smith-turba-3.0.0/root/etc/e-smith/templates/home/httpd/html/horde/turba/config/sources.php/40LocalSQL 2009-04-07 21:55:34.000000000 -0500 |
49 |
|
|
+++ mezzanine_patched_e-smith-turba-3.0.0/root/etc/e-smith/templates/home/httpd/html/horde/turba/config/sources.php/40LocalSQL 2009-04-07 21:53:05.000000000 -0500 |
50 |
|
|
@@ -71,6 +71,10 @@ |
51 |
|
|
'workProvince' => 'object_workprovince', |
52 |
|
|
'workPostalCode' => 'object_workpostalcode', |
53 |
|
|
'workCountry' => 'object_workcountry', |
54 |
|
|
+ 'workAddress' => array('fields' => array('workStreet', 'workCity', |
55 |
|
|
+ 'workProvince', |
56 |
|
|
+ 'workPostalCode'), |
57 |
|
|
+ 'format' => "%s \n %s, %s %s"), |
58 |
|
|
'timezone' => 'object_tz', |
59 |
|
|
'email' => 'object_email', |
60 |
|
|
'homePhone' => 'object_homephone', |
61 |
|
|
@@ -99,7 +103,7 @@ |
62 |
|
|
_("Location") => array('homeStreet', 'homePOBox', 'homeCity', |
63 |
|
|
'homeProvince', 'homePostalCode', 'homeCountry', |
64 |
|
|
'homeAddress', 'workStreet', 'workPOBox', 'workCity', |
65 |
|
|
- 'workProvince', 'workPostalCode', 'workCountry', |
66 |
|
|
+ 'workProvince', 'workPostalCode', 'workCountry', 'workAddress', |
67 |
|
|
'timezone'), |
68 |
|
|
_("Communications") => array('email', 'homePhone', 'workPhone', |
69 |
|
|
'cellPhone', 'fax', 'pager'), |
70 |
|
|
diff -Nur -x '*.orig' -x '*.rej' e-smith-turba-3.0.0/root/etc/e-smith/templates/home/httpd/html/horde/turba/scripts/upgrades/smeserver_2.1_to_2.2_sql_schema.php/10Start mezzanine_patched_e-smith-turba-3.0.0/root/etc/e-smith/templates/home/httpd/html/horde/turba/scripts/upgrades/smeserver_2.1_to_2.2_sql_schema.php/10Start |
71 |
|
|
--- e-smith-turba-3.0.0/root/etc/e-smith/templates/home/httpd/html/horde/turba/scripts/upgrades/smeserver_2.1_to_2.2_sql_schema.php/10Start 2008-06-19 22:34:28.000000000 -0500 |
72 |
|
|
+++ mezzanine_patched_e-smith-turba-3.0.0/root/etc/e-smith/templates/home/httpd/html/horde/turba/scripts/upgrades/smeserver_2.1_to_2.2_sql_schema.php/10Start 1969-12-31 18:00:00.000000000 -0600 |
73 |
|
|
@@ -1,22 +0,0 @@ |
74 |
|
|
-/** |
75 |
|
|
- * Very basic migration script for moving to the Turba 2.2 default sql schema. |
76 |
|
|
- * |
77 |
|
|
- * Note: This is NOT complete yet, but will get your Turba 2.1 data into |
78 |
|
|
- * enough shape to run with the new default sql schema in Turba 2.2. |
79 |
|
|
- * |
80 |
|
|
- * It is HIGHLY RECOMMENDED to back up your current Turba tables BEFORE |
81 |
|
|
- * attempting this upgrade! |
82 |
|
|
- * |
83 |
|
|
- * $Horde: turba/scripts/upgrades/2.1_to_2.2_sql_schema.php,v 1.18.2.7 2008/06/03 16:42:39 mrubinsk Exp $ |
84 |
|
|
- * |
85 |
|
|
- * Copyright 2007-2008 The Horde Project (http://www.horde.org/) |
86 |
|
|
- * |
87 |
|
|
- * See the enclosed file LICENSE for license information (ASL). If you |
88 |
|
|
- * did not receive this file, see http://www.horde.org/licenses/asl.php. |
89 |
|
|
- */ |
90 |
|
|
- |
91 |
|
|
-/* Set this variable to 'true' to activate the script. */ |
92 |
|
|
-$for_real = true; |
93 |
|
|
- |
94 |
|
|
-/* You must set these to an appropriate user/pass/table for your server. */ |
95 |
|
|
-$db_user = 'root'; |
96 |
|
|
diff -Nur -x '*.orig' -x '*.rej' e-smith-turba-3.0.0/root/etc/e-smith/templates/home/httpd/html/horde/turba/scripts/upgrades/smeserver_2.1_to_2.2_sql_schema.php/11Ldap_PW mezzanine_patched_e-smith-turba-3.0.0/root/etc/e-smith/templates/home/httpd/html/horde/turba/scripts/upgrades/smeserver_2.1_to_2.2_sql_schema.php/11Ldap_PW |
97 |
|
|
--- e-smith-turba-3.0.0/root/etc/e-smith/templates/home/httpd/html/horde/turba/scripts/upgrades/smeserver_2.1_to_2.2_sql_schema.php/11Ldap_PW 2008-06-19 22:34:28.000000000 -0500 |
98 |
|
|
+++ mezzanine_patched_e-smith-turba-3.0.0/root/etc/e-smith/templates/home/httpd/html/horde/turba/scripts/upgrades/smeserver_2.1_to_2.2_sql_schema.php/11Ldap_PW 1969-12-31 18:00:00.000000000 -0600 |
99 |
|
|
@@ -1,15 +0,0 @@ |
100 |
|
|
-{ |
101 |
|
|
- use esmith::util; |
102 |
|
|
- my $pw = esmith::util::LdapPassword; |
103 |
|
|
- $OUT .= "\$db_pass = '$pw';"; |
104 |
|
|
-} |
105 |
|
|
-$db_table = 'turba_objects'; |
106 |
|
|
- |
107 |
|
|
-/* Allow skipping of parsing certain fields. |
108 |
|
|
- * You can force fields to not be parsed by setting the field to false |
109 |
|
|
- * below. */ |
110 |
|
|
-$do_name = true; |
111 |
|
|
-$do_home = true; |
112 |
|
|
-$do_work = true; |
113 |
|
|
-$do_email = true; |
114 |
|
|
- |
115 |
|
|
diff -Nur -x '*.orig' -x '*.rej' e-smith-turba-3.0.0/root/etc/e-smith/templates/home/httpd/html/horde/turba/scripts/upgrades/smeserver_2.1_to_2.2_sql_schema.php/12Cli mezzanine_patched_e-smith-turba-3.0.0/root/etc/e-smith/templates/home/httpd/html/horde/turba/scripts/upgrades/smeserver_2.1_to_2.2_sql_schema.php/12Cli |
116 |
|
|
--- e-smith-turba-3.0.0/root/etc/e-smith/templates/home/httpd/html/horde/turba/scripts/upgrades/smeserver_2.1_to_2.2_sql_schema.php/12Cli 2008-06-19 22:34:28.000000000 -0500 |
117 |
|
|
+++ mezzanine_patched_e-smith-turba-3.0.0/root/etc/e-smith/templates/home/httpd/html/horde/turba/scripts/upgrades/smeserver_2.1_to_2.2_sql_schema.php/12Cli 1969-12-31 18:00:00.000000000 -0600 |
118 |
|
|
@@ -1,271 +0,0 @@ |
119 |
|
|
-/* YOU SHOULD NOT HAVE TO TOUCH ANYTHING BELOW THIS LINE */ |
120 |
|
|
-@define('AUTH_HANDLER', true); |
121 |
|
|
-@define('HORDE_BASE', dirname(__FILE__) . '/../../..'); |
122 |
|
|
- |
123 |
|
|
-/* Set up the CLI environment */ |
124 |
|
|
-require_once HORDE_BASE . '/lib/core.php'; |
125 |
|
|
-require_once 'Horde/CLI.php'; |
126 |
|
|
-if (!Horde_CLI::runningFromCli()) \{ |
127 |
|
|
- exit("Must be run from the command line\n"); |
128 |
|
|
-\} |
129 |
|
|
-$cli = &Horde_CLI::singleton(); |
130 |
|
|
-$cli->init(); |
131 |
|
|
- |
132 |
|
|
-/* Grab what we need to steal the DB config */ |
133 |
|
|
-require_once HORDE_BASE . '/config/conf.php'; |
134 |
|
|
-require_once 'Horde/Form.php'; |
135 |
|
|
-require 'Horde/NLS/carsigns.php'; |
136 |
|
|
-require_once 'DB.php'; |
137 |
|
|
- |
138 |
|
|
-$config = $GLOBALS['conf']['sql']; |
139 |
|
|
-$config['username'] = $db_user; |
140 |
|
|
-$config['password'] = $db_pass; |
141 |
|
|
-unset($config['charset']); |
142 |
|
|
-$db = DB::connect($config); |
143 |
|
|
-if (is_a($db, 'PEAR_Error')) \{ |
144 |
|
|
- Horde::fatal($db, __FILE__, __LINE__); |
145 |
|
|
-\} |
146 |
|
|
-if (!$for_real) \{ |
147 |
|
|
- $cli->message('No changes will done to the existing data. Please read the comments in the code, then set the $for_real flag to true before running.', 'cli.message'); |
148 |
|
|
-\} |
149 |
|
|
- |
150 |
|
|
-/* Define how to transform the address book table */ |
151 |
|
|
-$queries = array( |
152 |
|
|
- 'ALTER TABLE ' . $db_table . ' ADD COLUMN object_firstname VARCHAR(255)', |
153 |
|
|
- 'ALTER TABLE ' . $db_table . ' ADD COLUMN object_lastname VARCHAR(255)', |
154 |
|
|
- 'UPDATE ' . $db_table . ' SET object_lastname = object_name', |
155 |
|
|
- 'ALTER TABLE ' . $db_table . ' DROP COLUMN object_name', |
156 |
|
|
- 'ALTER TABLE ' . $db_table . ' ADD COLUMN object_middlenames VARCHAR(255)', |
157 |
|
|
- 'ALTER TABLE ' . $db_table . ' ADD COLUMN object_nameprefix VARCHAR(255)', |
158 |
|
|
- 'ALTER TABLE ' . $db_table . ' ADD COLUMN object_namesuffix VARCHAR(32)', |
159 |
|
|
- 'ALTER TABLE ' . $db_table . ' ADD COLUMN object_phototype VARCHAR(10)', |
160 |
|
|
- 'ALTER TABLE ' . $db_table . ' ADD COLUMN object_bday VARCHAR(10)', |
161 |
|
|
- 'ALTER TABLE ' . $db_table . ' ADD COLUMN object_homestreet VARCHAR(255)', |
162 |
|
|
- 'UPDATE ' . $db_table . ' SET object_homestreet = object_homeaddress', |
163 |
|
|
- 'ALTER TABLE ' . $db_table . ' DROP COLUMN object_homeaddress', |
164 |
|
|
- 'ALTER TABLE ' . $db_table . ' ADD COLUMN object_homepob VARCHAR(10)', |
165 |
|
|
- 'ALTER TABLE ' . $db_table . ' ADD COLUMN object_homecity VARCHAR(255)', |
166 |
|
|
- 'ALTER TABLE ' . $db_table . ' ADD COLUMN object_homeprovince VARCHAR(255)', |
167 |
|
|
- 'ALTER TABLE ' . $db_table . ' ADD COLUMN object_homepostalcode VARCHAR(255)', |
168 |
|
|
- 'ALTER TABLE ' . $db_table . ' ADD COLUMN object_homecountry VARCHAR(255)', |
169 |
|
|
- 'ALTER TABLE ' . $db_table . ' ADD COLUMN object_workstreet VARCHAR(255)', |
170 |
|
|
- 'UPDATE ' . $db_table . ' SET object_workstreet = object_workaddress', |
171 |
|
|
- 'ALTER TABLE ' . $db_table . ' DROP COLUMN object_workaddress', |
172 |
|
|
- 'ALTER TABLE ' . $db_table . ' ADD COLUMN object_workpob VARCHAR(10)', |
173 |
|
|
- 'ALTER TABLE ' . $db_table . ' ADD COLUMN object_workcity VARCHAR(255)', |
174 |
|
|
- 'ALTER TABLE ' . $db_table . ' ADD COLUMN object_workprovince VARCHAR(255)', |
175 |
|
|
- 'ALTER TABLE ' . $db_table . ' ADD COLUMN object_workpostalcode VARCHAR(255)', |
176 |
|
|
- 'ALTER TABLE ' . $db_table . ' ADD COLUMN object_workcountry VARCHAR(255)', |
177 |
|
|
- 'ALTER TABLE ' . $db_table . ' ADD COLUMN object_tz VARCHAR(32)', |
178 |
|
|
- 'ALTER TABLE ' . $db_table . ' ADD COLUMN object_geo VARCHAR(255)', |
179 |
|
|
- 'ALTER TABLE ' . $db_table . ' ADD COLUMN object_pager VARCHAR(25)', |
180 |
|
|
- 'ALTER TABLE ' . $db_table . ' ADD COLUMN object_role VARCHAR(255)', |
181 |
|
|
- 'ALTER TABLE ' . $db_table . ' ADD COLUMN object_logotype VARCHAR(10)', |
182 |
|
|
- 'ALTER TABLE ' . $db_table . ' ADD COLUMN object_category VARCHAR(80)', |
183 |
|
|
- 'ALTER TABLE ' . $db_table . ' ADD COLUMN object_url VARCHAR(255)', |
184 |
|
|
- 'CREATE INDEX turba_email_idx ON ' . $db_table . ' (object_email)', |
185 |
|
|
- 'CREATE INDEX turba_firstname_idx ON ' . $db_table . ' (object_firstname)', |
186 |
|
|
- 'CREATE INDEX turba_lastname_idx ON ' . $db_table . ' (object_lastname)', |
187 |
|
|
-); |
188 |
|
|
-switch ($config['phptype']) \{ |
189 |
|
|
-case 'mssql': |
190 |
|
|
- $queries[] = 'ALTER TABLE ' . $db_table . ' ADD COLUMN object_photo VARBINARY(MAX)'; |
191 |
|
|
- $queries[] = 'ALTER TABLE ' . $db_table . ' ADD COLUMN object_logo VARBINARY(MAX)'; |
192 |
|
|
- break; |
193 |
|
|
-case 'pgsql': |
194 |
|
|
- $queries[] = 'ALTER TABLE ' . $db_table . ' ADD COLUMN object_photo TEXT'; |
195 |
|
|
- $queries[] = 'ALTER TABLE ' . $db_table . ' ADD COLUMN object_logo TEXT'; |
196 |
|
|
- break; |
197 |
|
|
-default: |
198 |
|
|
- $queries[] = 'ALTER TABLE ' . $db_table . ' ADD COLUMN object_photo BLOB'; |
199 |
|
|
- $queries[] = 'ALTER TABLE ' . $db_table . ' ADD COLUMN object_logo BLOB'; |
200 |
|
|
- break; |
201 |
|
|
-\} |
202 |
|
|
- |
203 |
|
|
-/* Perform the queries */ |
204 |
|
|
-/* @TODO - Better error handling */ |
205 |
|
|
-$error = false; |
206 |
|
|
-foreach ($queries as $query) \{ |
207 |
|
|
- if ($for_real) \{ |
208 |
|
|
- $results = $db->query($query); |
209 |
|
|
- if (is_a($results, 'PEAR_Error')) \{ |
210 |
|
|
- $cli->message($results->toString(), 'cli.error'); |
211 |
|
|
- $error = true; |
212 |
|
|
- continue; |
213 |
|
|
- \} |
214 |
|
|
- \} |
215 |
|
|
- $cli->message($query, 'cli.success'); |
216 |
|
|
-\} |
217 |
|
|
-if ($error && |
218 |
|
|
- $cli->prompt('Continue?', array('y' => 'Yes', 'n' => 'No'), 'n') != 'y') \{ |
219 |
|
|
- exit(1); |
220 |
|
|
-\} |
221 |
|
|
- |
222 |
|
|
-/* Attempt to transform the fullname into lastname and firstname */ |
223 |
|
|
-if ($do_name) \{ |
224 |
|
|
- require_once HORDE_BASE . '/turba/lib/Turba.php'; |
225 |
|
|
- $sql = 'SELECT object_id, ' . ($for_real ? 'object_lastname' : 'object_name') . ' FROM ' . $db_table; |
226 |
|
|
- $names = $db->getAssoc($sql); |
227 |
|
|
- if (is_a($names, 'PEAR_Error')) \{ |
228 |
|
|
- $cli->message($names->toString(), 'cli.error'); |
229 |
|
|
- exit(1); |
230 |
|
|
- \} |
231 |
|
|
- $insert_query = 'UPDATE ' . $db_table . ' SET object_firstname = ?, object_lastname = ? WHERE object_id = ?'; |
232 |
|
|
- if (!$for_real) \{ |
233 |
|
|
- $cli->writeln($insert_query); |
234 |
|
|
- \} |
235 |
|
|
- $insert = $db->prepare($insert_query); |
236 |
|
|
- foreach ($names as $id => $name ) \{ |
237 |
|
|
- $lastname = Turba::guessLastName($name); |
238 |
|
|
- $firstname = ''; |
239 |
|
|
- if (strpos($name, ',') !== false) \{ |
240 |
|
|
- $firstname = preg_replace('/' . preg_quote($lastname, '/') . ',\s*/', '', $name); |
241 |
|
|
- \} elseif ($name != $lastname) \{ |
242 |
|
|
- $firstname = preg_replace('/\s+' . preg_quote($lastname, '/') . '/', '', $name); |
243 |
|
|
- \} |
244 |
|
|
- if ($for_real) \{ |
245 |
|
|
- $db->execute($insert, array($firstname, $lastname, $id)); |
246 |
|
|
- \} else \{ |
247 |
|
|
- $cli->writeln("ID=$id\nFirst name: $firstname; Last name: $lastname; Name: $name\n"); |
248 |
|
|
- \} |
249 |
|
|
- \} |
250 |
|
|
- $cli->message('Contact name fields parsed.', 'cli.success'); |
251 |
|
|
-\} else \{ |
252 |
|
|
- $cli->message('Contact name fields SKIPPED.', 'cli.success'); |
253 |
|
|
-\} |
254 |
|
|
- |
255 |
|
|
-if ($do_home) \{ |
256 |
|
|
- $sql = 'SELECT object_id, ' . ($for_real ? 'object_homestreet' : 'object_homeaddress') . ' FROM ' . $db_table; |
257 |
|
|
- $addresses = $db->getAssoc($sql); |
258 |
|
|
- if (is_a($addresses, 'PEAR_Error')) \{ |
259 |
|
|
- $cli->message($addresses->toString(), 'cli.error'); |
260 |
|
|
- exit(1); |
261 |
|
|
- \} |
262 |
|
|
- $insert_query = 'UPDATE ' . $db_table . ' SET object_homestreet = ?, object_homecity = ?, object_homeprovince = ?, object_homepostalcode = ?, object_homecountry = ? WHERE object_id = ?'; |
263 |
|
|
- if (!$for_real) \{ |
264 |
|
|
- $cli->writeln($insert_query); |
265 |
|
|
- \} |
266 |
|
|
- $insert = $db->prepare($insert_query); |
267 |
|
|
- parseAddress($addresses, $insert, $for_real); |
268 |
|
|
- $cli->message('Home address fields parsed.', 'cli.success'); |
269 |
|
|
-\} else \{ |
270 |
|
|
- $cli->message('Home address fields SKIPPED.', 'cli.success'); |
271 |
|
|
-\} |
272 |
|
|
- |
273 |
|
|
-if ($do_work) \{ |
274 |
|
|
- $sql = 'SELECT object_id, ' . ($for_real ? 'object_workstreet' : 'object_workaddress') . ' FROM ' . $db_table; |
275 |
|
|
- $addresses = $db->getAssoc($sql); |
276 |
|
|
- if (is_a($addresses, 'PEAR_Error')) \{ |
277 |
|
|
- $cli->message($addresses->toString(), 'cli.error'); |
278 |
|
|
- exit(1); |
279 |
|
|
- \} |
280 |
|
|
- $insert_query = 'UPDATE ' . $db_table . ' SET object_workstreet = ?, object_workcity = ?, object_workprovince = ?, object_workpostalcode = ?, object_workcountry = ? WHERE object_id = ?'; |
281 |
|
|
- if (!$for_real) \{ |
282 |
|
|
- $cli->writeln($insert_query); |
283 |
|
|
- \} |
284 |
|
|
- $insert = $db->prepare($insert_query); |
285 |
|
|
- parseAddress($addresses, $insert, $for_real); |
286 |
|
|
- $cli->message('Work address fields parsed.', 'cli.success'); |
287 |
|
|
-\} else \{ |
288 |
|
|
- $cli->message('Work address fields SKIPPED.', 'cli.success'); |
289 |
|
|
-\} |
290 |
|
|
- |
291 |
|
|
-if ($do_email) \{ |
292 |
|
|
- $sql = 'SELECT object_id, object_email FROM ' . $db_table; |
293 |
|
|
- $emails = $db->getAssoc($sql); |
294 |
|
|
- if (is_a($emails, 'PEAR_Error')) \{ |
295 |
|
|
- $cli->message($emails->toString(), 'cli.error'); |
296 |
|
|
- exit(1); |
297 |
|
|
- \} |
298 |
|
|
- $insert_query = 'UPDATE ' . $db_table . ' SET object_email = ? WHERE object_id = ?'; |
299 |
|
|
- if (!$for_real) \{ |
300 |
|
|
- $cli->writeln($insert_query); |
301 |
|
|
- \} |
302 |
|
|
- if ($for_real) \{ |
303 |
|
|
- $insert = $db->prepare($insert_query); |
304 |
|
|
- foreach ($emails as $id => $email) \{ |
305 |
|
|
- $db->execute($insert, array(getBareEmail($email), $id)); |
306 |
|
|
- \} |
307 |
|
|
- \} else \{ |
308 |
|
|
- $cli->writeln($insert_query); |
309 |
|
|
- \} |
310 |
|
|
-\} |
311 |
|
|
- |
312 |
|
|
-/** |
313 |
|
|
- * Helper function to parse out freeform addresses |
314 |
|
|
- * |
315 |
|
|
- * Try to parse out the free form addresses. |
316 |
|
|
- * Assumptions we make to fit into our schema: |
317 |
|
|
- * - Postal code is on the same line as state/province information |
318 |
|
|
- * - If there is a line following the state/province/postal code line, |
319 |
|
|
- * it is taken as a country. |
320 |
|
|
- * - Any lines before the postal code are treated as street address. |
321 |
|
|
- * |
322 |
|
|
- * @param array $addresses An array of addresses to parse. |
323 |
|
|
- * @param object $insert A prepared update query to write the results. |
324 |
|
|
- * @param boolean $for_real Whether to really change any data. |
325 |
|
|
- */ |
326 |
|
|
-function parseAddress($addresses, $insert, $for_real) |
327 |
|
|
-\{ |
328 |
|
|
- global $countries; |
329 |
|
|
- |
330 |
|
|
- foreach ($addresses as $id => $address) \{ |
331 |
|
|
- if (empty($address)) \{ |
332 |
|
|
- continue; |
333 |
|
|
- \} |
334 |
|
|
- $city = $state = $postalCode = $street = $country = ''; |
335 |
|
|
- $p_address = Horde_Form_Type_address::parse($address); |
336 |
|
|
- if (!count($p_address)) \{ |
337 |
|
|
- $street = $address; |
338 |
|
|
- \} else \{ |
339 |
|
|
- if (!empty($p_address['street'])) \{ |
340 |
|
|
- $street = $p_address['street']; |
341 |
|
|
- \} |
342 |
|
|
- if (!empty($p_address['city'])) \{ |
343 |
|
|
- $city = $p_address['city']; |
344 |
|
|
- \} |
345 |
|
|
- if (!empty($p_address['state'])) \{ |
346 |
|
|
- $state = $p_address['state']; |
347 |
|
|
- \} |
348 |
|
|
- if (!empty($p_address['zip'])) \{ |
349 |
|
|
- $postalCode = $p_address['zip']; |
350 |
|
|
- \} |
351 |
|
|
- if (!empty($p_address['country'])) \{ |
352 |
|
|
- $country = isset($countries[String::upper($p_address['country'])]) |
353 |
|
|
- ? $countries[String::upper($p_address['country'])] |
354 |
|
|
- : String::upper($p_address['country']); |
355 |
|
|
- \} |
356 |
|
|
- \} |
357 |
|
|
- if ($for_real) \{ |
358 |
|
|
- $GLOBALS['db']->execute($insert, array($street, $city, $state, $postalCode, $country, $id)); |
359 |
|
|
- \} else \{ |
360 |
|
|
- $GLOBALS['cli']->writeln("ID: $id\nStreet: $street\nCity: $city\nState: $state\nPostal Code: $postalCode\nCountry: $country\nAddress:\n$address\n"); |
361 |
|
|
- \} |
362 |
|
|
- \} |
363 |
|
|
-\} |
364 |
|
|
- |
365 |
|
|
-/** |
366 |
|
|
- * Static function to make a given email address rfc822 compliant. |
367 |
|
|
- * |
368 |
|
|
- * @param string $address An email address. |
369 |
|
|
- * |
370 |
|
|
- * @return string The RFC822-formatted email address. |
371 |
|
|
- */ |
372 |
|
|
-function getBareEmail($address) |
373 |
|
|
-\{ |
374 |
|
|
- // Empty values are still empty. |
375 |
|
|
- if (!$address) \{ |
376 |
|
|
- return $address; |
377 |
|
|
- \} |
378 |
|
|
- |
379 |
|
|
- require_once 'Mail/RFC822.php'; |
380 |
|
|
- require_once 'Horde/MIME.php'; |
381 |
|
|
- |
382 |
|
|
- static $rfc822; |
383 |
|
|
- if (is_null($rfc822)) \{ |
384 |
|
|
- $rfc822 = new Mail_RFC822(); |
385 |
|
|
- \} |
386 |
|
|
- |
387 |
|
|
- $rfc822->validateMailbox($address); |
388 |
|
|
- return MIME::rfc822WriteAddress($address->mailbox, $address->host); |
389 |
|
|
-\} |
390 |
|
|
diff -Nur -x '*.orig' -x '*.rej' e-smith-turba-3.0.0/root/etc/e-smith/templates.metadata/etc/e-smith/sql/init/49turba_migrate_contacts mezzanine_patched_e-smith-turba-3.0.0/root/etc/e-smith/templates.metadata/etc/e-smith/sql/init/49turba_migrate_contacts |
391 |
|
|
--- e-smith-turba-3.0.0/root/etc/e-smith/templates.metadata/etc/e-smith/sql/init/49turba_migrate_contacts 2008-06-19 22:40:07.000000000 -0500 |
392 |
|
|
+++ mezzanine_patched_e-smith-turba-3.0.0/root/etc/e-smith/templates.metadata/etc/e-smith/sql/init/49turba_migrate_contacts 1969-12-31 18:00:00.000000000 -0600 |
393 |
|
|
@@ -1 +0,0 @@ |
394 |
|
|
-PERMS=0544 |
395 |
|
|
diff -Nur -x '*.orig' -x '*.rej' e-smith-turba-3.0.0/root/etc/e-smith/templates.metadata/home/httpd/html/horde/turba/scripts/upgrades/smeserver_2.1_to_2.2_sql_schema.php mezzanine_patched_e-smith-turba-3.0.0/root/etc/e-smith/templates.metadata/home/httpd/html/horde/turba/scripts/upgrades/smeserver_2.1_to_2.2_sql_schema.php |
396 |
|
|
--- e-smith-turba-3.0.0/root/etc/e-smith/templates.metadata/home/httpd/html/horde/turba/scripts/upgrades/smeserver_2.1_to_2.2_sql_schema.php 2008-06-19 23:03:40.000000000 -0500 |
397 |
|
|
+++ mezzanine_patched_e-smith-turba-3.0.0/root/etc/e-smith/templates.metadata/home/httpd/html/horde/turba/scripts/upgrades/smeserver_2.1_to_2.2_sql_schema.php 1969-12-31 18:00:00.000000000 -0600 |
398 |
|
|
@@ -1,2 +0,0 @@ |
399 |
|
|
-PERMS=0700 |
400 |
|
|
-GID="www" |