/[drupal]/contributions/modules/cas/cas.install
ViewVC logotype

Contents of /contributions/modules/cas/cas.install

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (show annotations) (download) (as text)
Mon Mar 16 16:41:50 2009 UTC (8 months, 2 weeks ago) by metzlerd
Branch: MAIN
CVS Tags: DRUPAL-6--2-0-BETA1, HEAD
Branch point for: DRUPAL-6--2, DRUPAL-5--4
Changes since 1.1: +19 -11 lines
File MIME type: text/x-php
Coding conventions cleanup.
1 <?php
2 // $Id: cas.install,v 1.44 2008/07/31 15:20:41 metzlerd Exp $
3
4 /**
5 * @file CAS Install
6 *
7 */
8
9
10 /**
11 * Inastall db tables.
12 *
13 */
14 function cas_install() {
15 switch ($GLOBALS['db_type']) {
16 case 'mysql':
17 case 'mysqli':
18 // the {tablename} syntax is so multisite installs can add a
19 // prefix to the table name as set in the settings.php file
20 db_query("CREATE TABLE {cas_login_data} (
21 cas_session_id varchar(256) NOT NULL default '',
22 uid int unsigned NOT NULL,
23 PRIMARY KEY (cas_session_id)
24 ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
25 break;
26
27 case 'pgsql':
28 db_query("CREATE TABLE {cas_login_data} (
29 cas_session_id varchar(256) NOT NULL default '',
30 uid integer NOT NULL CHECK (uid >= 0),
31 PRIMARY KEY (cas_session_id)
32 )");
33
34 // Pgsql requires keys and indexes to be defined separately.
35 // It's important to name the index as {tablename}_fieldname_idx
36 // (the trailing _idx!) so update scripts can be written easily
37 db_query("CREATE INDEX {cas_login_data}_uid_idx
38 ON {cas_login_data} (uid)");
39 break;
40 }
41 }
42
43 function cas_update_1() {
44 switch ($GLOBALS['db_type']) {
45 case 'mysql':
46 case 'mysqli':
47 $items = array();
48 $items[] = update_sql("CREATE TABLE {cas_login_data} (
49 cas_session_id varchar(256) NOT NULL default '',
50 uid int unsigned NOT NULL,
51 PRIMARY KEY (cas_session_id)
52 ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
53 return $items;
54 break;
55
56 case 'pgsql':
57 $items = array();
58 $items[] = update_sql("CREATE TABLE {cas_login_data} (
59 cas_session_id varchar(256) NOT NULL default '',
60 uid integer NOT NULL CHECK (uid >= 0),
61 PRIMARY KEY (cas_session_id)
62 )");
63
64 // Pgsql requires keys and indexes to be defined separately.
65 // It's important to name the index as {tablename}_fieldname_idx
66 // (the trailing _idx!) so update scripts can be written easily
67 $items[] = update_sql("CREATE INDEX {cas_login_data}_uid_idx
68 ON {cas_login_data} (uid)");
69 return $items;
70 break;
71 }
72 }
73
74 function cas_uninstall() {
75 if ($GLOBALS['db_type'] == 'pgsql') {
76 db_query('DROP INDEX {cas_login_data}_uid_idx');
77 }
78 db_query('DROP TABLE {cas_login_data}');
79 }

  ViewVC Help
Powered by ViewVC 1.1.2