Project

General

Profile

Download (1.71 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
// $Id: shib_auth.install,v 1.3.4.2.2.1.2.6 2008/09/26 11:58:24 niif Exp $
3

    
4
/**
5
 * @file
6
 * Installation file of the shib_auth module.
7
 */
8

    
9
/**
10
 * Implementation of hook_install().
11
 */
12
function shib_auth_install() {
13
  switch ($GLOBALS['db_type']) {
14
    case 'mysql':
15
    case 'mysqli':
16
      db_query("CREATE TABLE {shib_auth} (
17
                id int(10) unsigned NOT NULL auto_increment,
18
                field varchar(128) default '',
19
                regexpression varchar(128) default '',
20
                role varchar(128) default '',
21
                PRIMARY KEY  (id)
22
              ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
23
      break;
24
    case pgsql: //TODO
25
      db_query("CREATE TABLE  {shib_auth} (
26
                id iserial CHECK (id>=0),
27
                field varchar(128) default '',
28
                regexpression varchar(128) default '',
29
                role varchar(128) default '',
30
                PRIMARY KEY  (id)
31
              )");
32

    
33
  }
34
  db_query("UPDATE {system} SET bootstrap=1, weight=-100 WHERE name='shib_auth'");
35
  drupal_set_message(t('Shibboleth authentication module installed successfully.'));
36
}
37

    
38
/**
39
 * Implementation of hook_uninstall().
40
 */
41
function shib_auth_uninstall() {
42

    
43
  // Drop variables.
44
  $variables = array(
45
    'auth_link_text',
46
    'shib_auth_handler_url',
47
    'shib_auth_handler_protocol',
48
    'shib_auth_wayf_uri',
49
    'shib_auth_username_variable',
50
    'shib_auth_username_email',
51
  );
52
  foreach ($variables as $variable) {
53
    variable_del($variable);
54
  }
55
  db_query("DROP TABLE {shib_auth}");
56

    
57
  drupal_set_message(t('The Shibboleth authentication module was uninstalled successfully.'));
58
}
59

    
60
/**
61
 * Implementation of hook_update
62
 */
63
function shib_auth_update_5310() {
64
  shib_auth_install();
65
}
(5-5/7)