Project

General

Profile

Download (1.56 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
//$Id: expertsdb_address_belgium.install,v 1.1 2007/08/16 01:33:16 rconstantine Exp $;
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_belgium_install() {
11
  $query_ok = TRUE;
12
  include_once('./'. drupal_get_path('module', 'expertsdb_address_belgium') .'/expertsdb_address_belgium.module');
13
  $query_ok = expertsdb_address_belgium_installstates($query_ok);
14
  if ($query_ok) {
15
    drupal_set_message('The expertsdb_address_Belgium module was installed successfully. The database was updated.');
16
  }
17
  else {
18
    drupal_set_message('There was an error installing expertsdb_address_Belgium.', 'error');
19
  }
20
}
21

    
22
/**
23
 * Implementation of hook_uninstall().
24
 */
25
function expertsdb_address_belgium_uninstall() {
26
  if (db_table_exists('expertsdb_address_states')) {
27
    $query1 = db_query("DELETE FROM {expertsdb_address_states} WHERE country_code = '%s'", 'BE');
28
  }
29
  if (db_table_exists('expertsdb_address_countries')) {
30
    $query2 = db_query("DELETE FROM {expertsdb_address_countries} WHERE country_code = '%s'", 'BE');
31
  }
32

    
33
  if ($query1 && $query2) {
34
    drupal_set_message('The expertsdb_address_Belgium 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
}
(7-7/23)