/usr/share/drupal6/modules/masquerade/masquerade.install is in drupal6-mod-masquerade 1.7-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 | <?php
/**
* @file masquerade.install
*
* Install, uninstall and update hooks for the Masquarade module.
*/
/**
* Implementation of hook_schema().
*
* @return array
*/
function masquerade_schema() {
return array(
'masquerade' => array(
'description' => "Each masquerading user has their session recorded into the masquerade table. Each record represents a masquerading user.",
'fields' => array(
'sid' => array(
'description' => "The current session for this masquerading user corresponding to their {sessions}.sid.",
'type' => 'varchar',
'length' => '64',
'not null' => TRUE,
'default' => ''),
'uid_from' => array(
'description' => 'The {users}.uid corresponding to a session.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'disp-width' => '10'),
'uid_as' => array(
'description' => 'The {users}.uid this session is masquerading as.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'disp-width' => '10')
),
'indexes' => array(
'sid' => array('sid', 'uid_from'),
'sid_2' => array('sid', 'uid_as')
)
),
'masquerade_users' => array(
'description' => 'Per-user permission table granting permissions to switch as a specific user.',
'fields' => array(
'uid_from' => array(
'description' => 'The {users}.uid that can masquerade as {masquerade_users}.uid_to.',
'type' => 'int',
'not null' => true,
'default' => 0,
'disp-width' => 10,
),
'uid_to' => array(
'description' => 'The {users}.uid that {masquerade_users}.uid_from can masquerade as.',
'type' => 'int',
'not null' => true,
'default' => 0,
'disp-width' => 10,
),
),
'primary key' => array('uid_from', 'uid_to'),
),
);
}
/**
* Implementation of hook_install().
*/
function masquerade_install() {
drupal_install_schema('masquerade');
db_query("UPDATE {system} SET weight = -10 WHERE name = 'masquerade'");
}
/**
* Implementation of hook_uninstall().
*/
function masquerade_uninstall() {
drupal_uninstall_schema('masquerade');
variable_del('masquerade_test_user');
variable_del('masquerade_admin_roles');
variable_del('masquerade_quick_switches');
}
/**
* Implementation of hook_update_N().
*
* Update for http://drupal.org/node/281468
* Adding support for multiple quick links in the Masquerade block.
*/
function masquerade_update_5000() {
// If test user was previously configured, add that as the first quick switch user.
$masquerade_test_user = variable_get('masquerade_test_user', '');
$masquerade_test_uid = db_result(db_query("SELECT uid FROM {users} WHERE name = '%s'", $masquerade_test_user));
if ($masquerade_test_uid) {
variable_set('masquerade_quick_switches', array($masquerade_test_uid => $masquerade_test_uid));
}
return array();
}
/**
* Implementation of hook_update_N().
*/
function masquerade_update_6001() {
variable_set('masquerade_quick_switches', implode(',', variable_get('masquerade_quick_switches', array())));
return array();
}
/**
* Make the sid column match the length of the core sessions table (64 characters).
*/
function masquerade_update_6002() {
$ret = array();
db_drop_index($ret, 'masquerade', 'sid');
db_drop_index($ret, 'masquerade', 'sid_2');
db_change_field($ret, 'masquerade', 'sid', 'sid', array(
'type' => 'varchar',
'length' => '64',
'not null' => TRUE,
'default' => '')
);
db_add_index($ret, 'masquerade', 'sid', array('sid', 'uid_from'));
db_add_index($ret, 'masquerade', 'sid_2', array('sid', 'uid_as'));
return $ret;
}
/**
* Change masquerade_quick_switches variable to store a serialized array of
* user ID's. Reverts update 6001.
*/
function masquerade_update_6003() {
$users = variable_get('masquerade_quick_switches', NULL);
if (!empty($users)) {
$user_ids = drupal_explode_tags($users);
if (!empty($user_ids)) {
variable_set('masquerade_quick_switches', $user_ids);
}
}
else {
variable_del('masquerade_quick_switches');
}
return array();
}
/**
* Set the weight of the masquerade module to -10, but only if it hasn't
* previously been changed.
*/
function masquerade_update_6004() {
$ret = array();
$ret[] = update_sql("UPDATE {system} SET weight = -10 WHERE name = 'masquerade' AND weight = 0");
return $ret;
}
/**
* Add a table storing specific user pairings a user can masquerade as.
*/
function masquerade_update_6005() {
$ret = array();
$schema = array(
'masquerade_users' => array(
'fields' => array(
'uid_from' => array(
'type' => 'int',
'not null' => true,
'default' => 0,
'disp-width' => 10,
),
'uid_to' => array(
'type' => 'int',
'not null' => true,
'default' => 0,
'disp-width' => 10,
),
),
'primary key' => array('uid_from', 'uid_to'),
)
);
db_create_table($ret, 'masquerade_users', $schema['masquerade_users']);
return $ret;
}
/**
* Update masquerade block caching.
*/
function masquerade_update_6006() {
$ret = array();
$ret[] = update_sql("UPDATE {blocks} SET cache = -1 WHERE module = 'masquerade'");
return $ret;
}
|