1
|
<?php
|
2
|
|
3
|
/**
|
4
|
* Implementation of hook_install().
|
5
|
*
|
6
|
* For country codes, use http://www.iso.org/iso/en/prods-services/iso3166ma/02iso-3166-code-lists/list-en1.html
|
7
|
* If you are adding states or provinces for other countries, just duplicate the .inc, .install, and . module set for Canada.
|
8
|
* We should be able to grab what we need by Country Code. *
|
9
|
*/
|
10
|
function expertsdb_address_germany_install() {
|
11
|
$query_ok = TRUE;
|
12
|
include_once('./'. drupal_get_path('module', 'expertsdb_address_germany') .'/expertsdb_address_germany.module');
|
13
|
$query_ok = expertsdb_address_germany_installstates($query_ok);
|
14
|
if ($query_ok) {
|
15
|
drupal_set_message('The expertsdb_address_Germany module was installed successfully. The database was updated.');
|
16
|
}
|
17
|
else {
|
18
|
drupal_set_message('There was an error installing expertsdb_address_Germany.', 'error');
|
19
|
}
|
20
|
}
|
21
|
|
22
|
/**
|
23
|
* Implementation of hook_uninstall().
|
24
|
*/
|
25
|
function expertsdb_address_germany_uninstall() {
|
26
|
if (db_table_exists('expertsdb_address_states')) {
|
27
|
$query1 = db_query("DELETE FROM {expertsdb_address_states} WHERE country_code = '%s'", 'DE');
|
28
|
}
|
29
|
if (db_table_exists('expertsdb_address_countries')) {
|
30
|
$query2 = db_query("DELETE FROM {expertsdb_address_countries} WHERE country_code = '%s'", 'DE');
|
31
|
}
|
32
|
|
33
|
if ($query1 && $query2) {
|
34
|
drupal_set_message('The expertsdb_address_Germany module was uninstalled successfully.');
|
35
|
}
|
36
|
else {
|
37
|
drupal_set_message('There was an error removing the expertsdb_address database tables.', 'error');
|
38
|
}
|
39
|
|
40
|
}
|