Projet

Général

Profil

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

root / drupal7 / sites / all / modules / cas / cas_server.install @ 4f315dab

1 85ad3d82 Assos Assos
<?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' => 255,
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 a2baadd1 Assos Assos
      'valid' => array(
39
        'type' => 'int',
40
        'not null' => TRUE,
41
        'default' => 1,
42
      ),
43 85ad3d82 Assos Assos
    ),
44
    'primary key' => array('ticket'),
45
  );
46
47
  return $schema;
48
}
49
50 4f315dab Assos Assos
/**
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
}
57 85ad3d82 Assos Assos
58
/**
59
 * Creates CAS server tickets table.
60
 */
61 a2baadd1 Assos Assos
function cas_server_update_7000() {
62 85ad3d82 Assos Assos
  $schema = array();
63
64
  $schema['cas_server_tickets'] = array(
65
    'description' => 'Stores CAS server tickets.',
66
    'fields' => array(
67
      'service' => array(
68
        'type' => 'varchar',
69
        'length' => 255,
70
        'not null' => TRUE,
71
        'default' => '',
72
      ),
73
      'ticket' => array(
74
        'type' => 'varchar',
75
        'length' => 255,
76
        'not null' => TRUE,
77
        'default' => '',
78
      ),
79
      'uid' => array(
80
        'type' => 'int',
81
        'unsigned' => TRUE,
82
        'not null' => TRUE,
83
      ),
84
      'timestamp' => array(
85
        'type' => 'int',
86
        'not null' => TRUE,
87
      ),
88
    ),
89
    'primary key' => array('ticket'),
90
  );
91
92
  $ret = array();
93 e9f59589 Assos Assos
  if (!db_table_exists('cas_server_tickets')) {
94
    db_create_table('cas_server_tickets', $schema['cas_server_tickets']);
95
  }
96 85ad3d82 Assos Assos
  return $ret;
97
}
98 a2baadd1 Assos Assos
99
/**
100
 * Adds valid field to indicate when ticket is valid for reuse.
101
 */
102
function cas_server_update_7101() {
103 e9f59589 Assos Assos
  if (!db_field_exists('cas_server_tickets', 'valid')) {
104
    db_add_field('cas_server_tickets', 'valid', array('type' => 'int', 'not null' => TRUE, 'default' => 1, ));
105
  }
106 a2baadd1 Assos Assos
}