Projet

Général

Profil

Paste
Télécharger (2,61 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / cas / cas_server.install @ 082b75eb

1
<?php
2

    
3
/**
4
 * @file
5
 * Installation hooks for the CAS Server module.
6
 */
7

    
8
/**
9
 * Implements hook_schema().
10
 */
11
function cas_server_schema() {
12
  $schema = array();
13

    
14
  $schema['cas_server_tickets'] = array(
15
    'description' => 'Stores CAS server tickets.',
16
    'fields' => array(
17
      'service' => array(
18
        'type' => 'varchar',
19
        'length' => 1024,
20
        'not null' => TRUE,
21
        'default' => '',
22
      ),
23
      'ticket' => array(
24
        'type' => 'varchar',
25
        'length' => 255,
26
        'not null' => TRUE,
27
        'default' => '',
28
      ),
29
      'uid' => array(
30
        'type' => 'int',
31
        'unsigned' => TRUE,
32
        'not null' => TRUE,
33
      ),
34
      'timestamp' => array(
35
        'type' => 'int',
36
        'not null' => TRUE,
37
      ),
38
      'valid' => array(
39
        'type' => 'int',
40
        'not null' => TRUE,
41
        'default' => 1,
42
      ),
43
    ),
44
    'primary key' => array('ticket'),
45
  );
46

    
47
  return $schema;
48
}
49

    
50
/**
51
 * Implements hook_uninstall().
52
 */
53
function cas_server_uninstall() {
54
  variable_del('cas_server_service_whitelist');
55
  variable_del('cas_server_whitelist_failure');
56
  variable_get('cas_server_slo_individual_timeout');
57
  variable_get('cas_server_slo_group_timeout');
58
}
59

    
60
/**
61
 * Creates CAS server tickets table.
62
 */
63
function cas_server_update_7000() {
64
  $schema = array();
65

    
66
  $schema['cas_server_tickets'] = array(
67
    'description' => 'Stores CAS server tickets.',
68
    'fields' => array(
69
      'service' => array(
70
        'type' => 'varchar',
71
        'length' => 255,
72
        'not null' => TRUE,
73
        'default' => '',
74
      ),
75
      'ticket' => array(
76
        'type' => 'varchar',
77
        'length' => 255,
78
        'not null' => TRUE,
79
        'default' => '',
80
      ),
81
      'uid' => array(
82
        'type' => 'int',
83
        'unsigned' => TRUE,
84
        'not null' => TRUE,
85
      ),
86
      'timestamp' => array(
87
        'type' => 'int',
88
        'not null' => TRUE,
89
      ),
90
    ),
91
    'primary key' => array('ticket'),
92
  );
93

    
94
  $ret = array();
95
  if (!db_table_exists('cas_server_tickets')) {
96
    db_create_table('cas_server_tickets', $schema['cas_server_tickets']);
97
  }
98
  return $ret;
99
}
100

    
101
/**
102
 * Adds valid field to indicate when ticket is valid for reuse.
103
 */
104
function cas_server_update_7101() {
105
  if (!db_field_exists('cas_server_tickets', 'valid')) {
106
    db_add_field('cas_server_tickets', 'valid', array('type' => 'int', 'not null' => TRUE, 'default' => 1, ));
107
  }
108
}
109

    
110
/**
111
 * Increases 'service' field size to 1024.
112
 */
113
function cas_server_update_7102() {
114
  db_change_field('cas_server_tickets', 'service', 'service', array(
115
    'type' => 'varchar',
116
    'length' => 1024,
117
    'not null' => TRUE,
118
    'default' => '',
119
  ));
120
}