| 1 |
<?php
|
| 2 |
// $Id: hidden.install,v 1.2.2.2 2008/01/06 16:03:54 ekes Exp $
|
| 3 |
|
| 4 |
/**
|
| 5 |
* @file
|
| 6 |
* Installation file for hidden module.
|
| 7 |
*/
|
| 8 |
|
| 9 |
|
| 10 |
function hidden_install() {
|
| 11 |
drupal_install_schema('hidden');
|
| 12 |
db_query("INSERT INTO {hidden_reasons} (title, description, enabled) VALUES ('Policy Violation','The post violates the <a href=\"/guidelines\">Editorial Guidelines</a>.',1)");
|
| 13 |
}
|
| 14 |
|
| 15 |
|
| 16 |
function hidden_schema() {
|
| 17 |
$schema['hidden_node'] = array(
|
| 18 |
'fields' => array(
|
| 19 |
'hid' => array(
|
| 20 |
'type' => 'serial',
|
| 21 |
'unsigned' => TRUE,
|
| 22 |
'not null' => TRUE
|
| 23 |
),
|
| 24 |
'nid' => array(
|
| 25 |
'type' => 'int',
|
| 26 |
'unsigned' => TRUE,
|
| 27 |
'not null' => TRUE,
|
| 28 |
'default' => '0'
|
| 29 |
),
|
| 30 |
'created' => array(
|
| 31 |
'type' => 'int',
|
| 32 |
'unsigned' => TRUE,
|
| 33 |
'not null' => TRUE,
|
| 34 |
'default' => '0'
|
| 35 |
),
|
| 36 |
'rid' => array(
|
| 37 |
'type' => 'int',
|
| 38 |
'unsigned' => TRUE,
|
| 39 |
'not null' => TRUE,
|
| 40 |
'default' => 0,
|
| 41 |
'size' => 'tiny'),
|
| 42 |
'publicnote' => array(
|
| 43 |
'type' => 'text',
|
| 44 |
'not null' => TRUE
|
| 45 |
),
|
| 46 |
'privatenote' => array(
|
| 47 |
'type' => 'text',
|
| 48 |
'not null' => TRUE
|
| 49 |
),
|
| 50 |
'uid' => array(
|
| 51 |
'type' => 'int',
|
| 52 |
'unsigned' => TRUE,
|
| 53 |
'not null' => TRUE,
|
| 54 |
'default' => '0'
|
| 55 |
),
|
| 56 |
'delay' => array(
|
| 57 |
'type' => 'int',
|
| 58 |
'unsigned' => TRUE,
|
| 59 |
'not null' => TRUE,
|
| 60 |
'default' => '0'
|
| 61 |
)
|
| 62 |
),
|
| 63 |
'primary key' => array('hid', 'nid')
|
| 64 |
);
|
| 65 |
|
| 66 |
$schema['hidden_comment'] = array(
|
| 67 |
'fields' => array(
|
| 68 |
'hid' => array(
|
| 69 |
'type' => 'serial',
|
| 70 |
'unsigned' => TRUE,
|
| 71 |
'not null' => TRUE
|
| 72 |
),
|
| 73 |
'nid' => array(
|
| 74 |
'type' => 'int',
|
| 75 |
'unsigned' => TRUE,
|
| 76 |
'not null' => TRUE,
|
| 77 |
'default' => '0'
|
| 78 |
),
|
| 79 |
'cid' => array(
|
| 80 |
'type' => 'int',
|
| 81 |
'unsigned' => TRUE,
|
| 82 |
'not null' => TRUE,
|
| 83 |
'default' => '0'
|
| 84 |
),
|
| 85 |
'created' => array(
|
| 86 |
'type' => 'int',
|
| 87 |
'unsigned' => TRUE,
|
| 88 |
'not null' => TRUE,
|
| 89 |
'default' => '0'
|
| 90 |
),
|
| 91 |
'rid' => array(
|
| 92 |
'type' => 'int',
|
| 93 |
'unsigned' => TRUE,
|
| 94 |
'not null' => TRUE,
|
| 95 |
'default' => 0,
|
| 96 |
'size' => 'tiny'
|
| 97 |
),
|
| 98 |
'publicnote' => array(
|
| 99 |
'type' => 'text',
|
| 100 |
'not null' => TRUE
|
| 101 |
),
|
| 102 |
'privatenote' => array(
|
| 103 |
'type' => 'text',
|
| 104 |
'not null' => TRUE
|
| 105 |
),
|
| 106 |
'uid' => array(
|
| 107 |
'type' => 'int',
|
| 108 |
'unsigned' => TRUE,
|
| 109 |
'not null' => TRUE,
|
| 110 |
'default' => '0'
|
| 111 |
),
|
| 112 |
'delay' => array(
|
| 113 |
'type' => 'int',
|
| 114 |
'unsigned' => TRUE,
|
| 115 |
'not null' => TRUE,
|
| 116 |
'default' => '0'
|
| 117 |
)
|
| 118 |
),
|
| 119 |
'primary key' => array('hid', 'nid', 'cid')
|
| 120 |
);
|
| 121 |
|
| 122 |
$schema['hidden_reported_node'] = array(
|
| 123 |
'fields' => array(
|
| 124 |
'repid' => array(
|
| 125 |
'type' => 'serial',
|
| 126 |
'unsigned' => TRUE,
|
| 127 |
'not null' => TRUE
|
| 128 |
),
|
| 129 |
'nid' => array(
|
| 130 |
'type' => 'int',
|
| 131 |
'unsigned' => TRUE,
|
| 132 |
'not null' => TRUE,
|
| 133 |
'default' => '0'
|
| 134 |
),
|
| 135 |
'created' => array(
|
| 136 |
'type' => 'int',
|
| 137 |
'unsigned' => TRUE,
|
| 138 |
'not null' => TRUE,
|
| 139 |
'default' => '0'
|
| 140 |
),
|
| 141 |
'rid' => array(
|
| 142 |
'type' => 'int',
|
| 143 |
'unsigned' => TRUE,
|
| 144 |
'not null' => TRUE,
|
| 145 |
'default' => 0,
|
| 146 |
'size' => 'tiny'
|
| 147 |
),
|
| 148 |
'publicnote' => array(
|
| 149 |
'type' => 'text',
|
| 150 |
'not null' => TRUE
|
| 151 |
),
|
| 152 |
'privatenote' => array(
|
| 153 |
'type' => 'text',
|
| 154 |
'not null' => TRUE
|
| 155 |
),
|
| 156 |
'uid' => array(
|
| 157 |
'type' => 'int',
|
| 158 |
'unsigned' => TRUE,
|
| 159 |
'not null' => TRUE,
|
| 160 |
'default' => '0'
|
| 161 |
),
|
| 162 |
'seen' => array(
|
| 163 |
'type' => 'int',
|
| 164 |
'unsigned' => TRUE,
|
| 165 |
'size' => 'tiny'
|
| 166 |
),
|
| 167 |
'suid' => array(
|
| 168 |
'type' => 'int',
|
| 169 |
'unsigned' => TRUE
|
| 170 |
)
|
| 171 |
),
|
| 172 |
'primary key' => array('repid', 'nid')
|
| 173 |
);
|
| 174 |
|
| 175 |
$schema['hidden_reported_comment'] = array(
|
| 176 |
'fields' => array(
|
| 177 |
'repid' => array(
|
| 178 |
'type' => 'serial',
|
| 179 |
'unsigned' => TRUE,
|
| 180 |
'not null' => TRUE
|
| 181 |
),
|
| 182 |
'nid' => array(
|
| 183 |
'type' => 'int',
|
| 184 |
'unsigned' => TRUE,
|
| 185 |
'not null' => TRUE,
|
| 186 |
'default' => '0'
|
| 187 |
),
|
| 188 |
'cid' => array(
|
| 189 |
'type' => 'int',
|
| 190 |
'unsigned' => TRUE,
|
| 191 |
'not null' => TRUE,
|
| 192 |
'default' => '0'
|
| 193 |
),
|
| 194 |
'created' => array(
|
| 195 |
'type' => 'int',
|
| 196 |
'unsigned' => TRUE,
|
| 197 |
'not null' => TRUE,
|
| 198 |
'default' => '0'
|
| 199 |
),
|
| 200 |
'rid' => array(
|
| 201 |
'type' => 'int',
|
| 202 |
'unsigned' => TRUE,
|
| 203 |
'not null' => TRUE,
|
| 204 |
'default' => 0,
|
| 205 |
'size' => 'tiny'
|
| 206 |
),
|
| 207 |
'publicnote' => array(
|
| 208 |
'type' => 'text',
|
| 209 |
'not null' => TRUE
|
| 210 |
),
|
| 211 |
'privatenote' => array(
|
| 212 |
'type' => 'text',
|
| 213 |
'not null' => TRUE
|
| 214 |
),
|
| 215 |
'uid' => array(
|
| 216 |
'type' => 'int',
|
| 217 |
'unsigned' => TRUE,
|
| 218 |
'not null' => TRUE,
|
| 219 |
'default' => '0'
|
| 220 |
),
|
| 221 |
'seen' => array(
|
| 222 |
'type' => 'int',
|
| 223 |
'unsigned' => TRUE,
|
| 224 |
'size' => 'tiny'),
|
| 225 |
'suid' => array(
|
| 226 |
'type' => 'int',
|
| 227 |
'unsigned' => TRUE
|
| 228 |
)
|
| 229 |
),
|
| 230 |
'primary key' => array('repid', 'nid', 'cid')
|
| 231 |
);
|
| 232 |
|
| 233 |
$schema['hidden_reasons'] = array(
|
| 234 |
'fields' => array(
|
| 235 |
'rid' => array(
|
| 236 |
'type' => 'serial',
|
| 237 |
'unsigned' => TRUE,
|
| 238 |
'not null' => TRUE
|
| 239 |
),
|
| 240 |
'title' => array(
|
| 241 |
'type' => 'varchar',
|
| 242 |
'length' => '255',
|
| 243 |
'not null' => TRUE,
|
| 244 |
'default' => ''
|
| 245 |
),
|
| 246 |
'description' => array(
|
| 247 |
'type' => 'text'
|
| 248 |
),
|
| 249 |
'enabled' => array(
|
| 250 |
'type' => 'int',
|
| 251 |
'not null' => TRUE,
|
| 252 |
'default' => '1'
|
| 253 |
)
|
| 254 |
),
|
| 255 |
'primary key' => array('rid')
|
| 256 |
);
|
| 257 |
|
| 258 |
$schema['hidden_log'] = array(
|
| 259 |
'fields' => array(
|
| 260 |
'hidetime' => array(
|
| 261 |
'type' => 'int',
|
| 262 |
'unsigned' => TRUE,
|
| 263 |
'not null' => TRUE,
|
| 264 |
'default' => '0'
|
| 265 |
),
|
| 266 |
'action' => array(
|
| 267 |
'type' => 'int',
|
| 268 |
'unsigned' => TRUE,
|
| 269 |
'not null' => TRUE,
|
| 270 |
'default' => 0,
|
| 271 |
'size' => 'tiny'
|
| 272 |
),
|
| 273 |
'description' => array(
|
| 274 |
'type' => 'text',
|
| 275 |
'not null' => TRUE
|
| 276 |
),
|
| 277 |
'ids' => array(
|
| 278 |
'type' => 'text',
|
| 279 |
'not null' => TRUE
|
| 280 |
),
|
| 281 |
'uid' => array(
|
| 282 |
'type' => 'int',
|
| 283 |
'unsigned' => TRUE,
|
| 284 |
'not null' => TRUE,
|
| 285 |
'default' => '0'
|
| 286 |
)
|
| 287 |
),
|
| 288 |
'primary key' => array('hidetime')
|
| 289 |
);
|
| 290 |
|
| 291 |
$schema['hidden_filters'] = array(
|
| 292 |
'fields' => array(
|
| 293 |
'hfid' => array(
|
| 294 |
'type' => 'serial',
|
| 295 |
'unsigned' => TRUE,
|
| 296 |
'not null' => TRUE
|
| 297 |
),
|
| 298 |
'filter' => array(
|
| 299 |
'type' => 'varchar',
|
| 300 |
'length' => 255,
|
| 301 |
'not null' => TRUE
|
| 302 |
),
|
| 303 |
'type' => array(
|
| 304 |
'type' => 'int',
|
| 305 |
'size' => 'tiny',
|
| 306 |
'unsigned' => TRUE,
|
| 307 |
'not null' => TRUE,
|
| 308 |
'default' => '1'
|
| 309 |
),
|
| 310 |
'hits' => array(
|
| 311 |
'type' => 'int',
|
| 312 |
'unsigned' => TRUE,
|
| 313 |
'not null' => TRUE,
|
| 314 |
'default' => '0'
|
| 315 |
),
|
| 316 |
'lasthit' => array(
|
| 317 |
'type' => 'int',
|
| 318 |
'unsigned' => TRUE,
|
| 319 |
'not null' => TRUE,
|
| 320 |
'default' => '0'
|
| 321 |
),
|
| 322 |
'enabled' => array(
|
| 323 |
'type' => 'int',
|
| 324 |
'not null' => TRUE,
|
| 325 |
'default' => '1'
|
| 326 |
),
|
| 327 |
'weight' => array(
|
| 328 |
'type' => 'int',
|
| 329 |
'not null' => TRUE,
|
| 330 |
'default' => '0'
|
| 331 |
)
|
| 332 |
),
|
| 333 |
'primary key' => array('hfid')
|
| 334 |
);
|
| 335 |
|
| 336 |
$schema['hidden_filter_reasons'] = array(
|
| 337 |
'fields' => array(
|
| 338 |
'hfid' => array(
|
| 339 |
'type' => 'int',
|
| 340 |
'unsigned' => TRUE,
|
| 341 |
'not null' => TRUE,
|
| 342 |
),
|
| 343 |
'title' => array(
|
| 344 |
'type' => 'varchar',
|
| 345 |
'length' => 255,
|
| 346 |
'not null' => TRUE,
|
| 347 |
),
|
| 348 |
'rid' => array(
|
| 349 |
'type' => 'int',
|
| 350 |
'unsigned' => TRUE,
|
| 351 |
'not null' => TRUE,
|
| 352 |
'default' => 0,
|
| 353 |
'size' => 'tiny',
|
| 354 |
),
|
| 355 |
'publicnote' => array(
|
| 356 |
'type' => 'text',
|
| 357 |
'not null' => TRUE,
|
| 358 |
),
|
| 359 |
'privatenote' => array(
|
| 360 |
'type' => 'text',
|
| 361 |
'not null' => TRUE,
|
| 362 |
),
|
| 363 |
'uid' => array(
|
| 364 |
'type' => 'int',
|
| 365 |
'unsigned' => TRUE,
|
| 366 |
'not null' => TRUE,
|
| 367 |
'default' => '0',
|
| 368 |
),
|
| 369 |
'delay' => array(
|
| 370 |
'type' => 'int',
|
| 371 |
'unsigned' => TRUE,
|
| 372 |
'not null' => TRUE,
|
| 373 |
'default' => '0',
|
| 374 |
)
|
| 375 |
),
|
| 376 |
'primary key' => array('hfid')
|
| 377 |
);
|
| 378 |
|
| 379 |
return $schema;
|
| 380 |
}
|
| 381 |
|
| 382 |
|
| 383 |
function hidden_uninstall() {
|
| 384 |
/* do table data, particularly hidden data want to be lost on uninstall?
|
| 385 |
* if so should the nodes be published!? */
|
| 386 |
// Remove tables.
|
| 387 |
/*
|
| 388 |
drupal_uninstall_schema('hidden');
|
| 389 |
*/
|
| 390 |
} // end hidden_uninstall
|