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

Contents of /contributions/modules/masquerade/masquerade.install

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


Revision 1.5 - (show annotations) (download) (as text)
Fri Mar 6 20:34:59 2009 UTC (8 months, 3 weeks ago) by deekayen
Branch: MAIN
CVS Tags: HEAD
Changes since 1.4: +31 -12 lines
File MIME type: text/x-php
#392738 - increase sid column to match core sessions table length
#383500 - comma delimit quick switch users (broken autocomplete)
#390980 - revert cause it didn't work
misc sync with DRUPAL-6--1 changes
1 <?php
2 // $Id: masquerade.install,v 1.4.2.2 2009/03/06 19:58:16 deekayen Exp $
3
4 /**
5 * @file masquerade.install
6 *
7 * Install, uninstall and update hooks for the Masquarade module.
8 */
9
10 /**
11 * Implementation of hook_schema().
12 *
13 * @return array
14 */
15 function masquerade_schema() {
16 return array(
17 'masquerade' => array(
18 'fields' => array(
19 'sid' => array(
20 'type' => 'varchar',
21 'length' => '64',
22 'not null' => TRUE,
23 'default' => ''),
24 'uid_from' => array(
25 'type' => 'int',
26 'not null' => TRUE,
27 'default' => 0,
28 'disp-width' => '10'),
29 'uid_as' => array(
30 'type' => 'int',
31 'not null' => TRUE,
32 'default' => 0,
33 'disp-width' => '10')
34 ),
35 'indexes' => array(
36 'sid' => array('sid', 'uid_from'),
37 'sid_2' => array('sid', 'uid_as')
38 )
39 )
40 );
41 }
42
43 /**
44 * Implementation of hook_install().
45 */
46 function masquerade_install() {
47 drupal_install_schema('masquerade');
48 }
49
50 /**
51 * Implementation of hook_uninstall().
52 */
53 function masquerade_uninstall() {
54 drupal_uninstall_schema('masquerade');
55 variable_del('masquerade_test_user');
56 variable_del('masquerade_admin_roles');
57 variable_del('masquerade_quick_switches');
58 }
59
60 /**
61 * Implementation of hook_update_N().
62 *
63 * Update for http://drupal.org/node/281468
64 * Adding support for multiple quick links in the Masquerade block.
65 */
66 function masquerade_update_5000() {
67 // If test user was previously configured, add that as the first quick switch user.
68 $masquerade_test_user = variable_get('masquerade_test_user', '');
69 $masquerade_test_uid = db_result(db_query("SELECT uid FROM {users} WHERE name = '%s'", $masquerade_test_user));
70 if ($masquerade_test_uid) {
71 variable_set('masquerade_quick_switches', array($masquerade_test_uid => $masquerade_test_uid));
72 }
73 return array();
74 }
75
76 /**
77 * Implode the array of quick switch users because the configuration for quick switch is now a comma delimited list of usernames.
78 */
79 function masquerade_update_6001() {
80 variable_set('masquerade_quick_switches', implode(',', variable_get('masquerade_quick_switches', array())));
81 return array();
82 }
83
84 /**
85 * Make the sid column match the length of the core sessions table (64 characters).
86 */
87 function masquerade_update_6002() {
88 $ret = array();
89 db_drop_index($ret, 'masquerade', 'sid');
90 db_drop_index($ret, 'masquerade', 'sid_2');
91 db_change_field($ret, 'masquerade', 'sid', 'sid', array(
92 'type' => 'varchar',
93 'length' => '64',
94 'not null' => TRUE,
95 'default' => '')
96 );
97 db_add_index($ret, 'masquerade', 'sid', array('sid', 'uid_from'));
98 db_add_index($ret, 'masquerade', 'sid_2', array('sid', 'uid_as'));
99 return $ret;
100 }

  ViewVC Help
Powered by ViewVC 1.1.2