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

Contents of /contributions/modules/role_watchdog/role_watchdog.install

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


Revision 1.1 - (show annotations) (download) (as text)
Thu Aug 28 17:24:48 2008 UTC (14 months, 4 weeks ago) by gestaltware
Branch: MAIN
CVS Tags: DRUPAL-5--1-3, DRUPAL-5--1-2, HEAD
Branch point for: DRUPAL-6--1
File MIME type: text/x-php
<a href="http://drupal.org/node/279626">#279626</a> by ossemble: fixed sql error when email notification monitor role selected without notify role
<a href="http://drupal.org/node/279631">#279631</a> by ossemble: changed watchdog log message wording
added optional role history on each user's page
added support for module userlist
1 <?php
2 // $Id$
3
4 /**
5 * Implementation of hook_install().
6 */
7 function role_watchdog_install() {
8 switch ($GLOBALS['db_type']) {
9 case 'mysqli':
10 case 'mysql':
11 db_query("CREATE TABLE if not exists {role_watchdog} (
12 aid int(10) unsigned NOT NULL,
13 rid int(10) unsigned NOT NULL,
14 action tinyint(1) NOT NULL,
15 uid int(10) unsigned NOT NULL,
16 stamp int(10) unsigned NOT NULL,
17 KEY aid (aid)
18 ) TYPE=MyISAM /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
19 break;
20
21 case 'pgsql':
22 db_query("CREATE TABLE if not exists {role_watchdog} (
23 aid int(10) unsigned NOT NULL,
24 rid int(10) unsigned NOT NULL,
25 action tinyint(1) NOT NULL,
26 uid int(10) unsigned NOT NULL,
27 stamp int(10) unsigned NOT NULL,
28 KEY aid (aid)
29 )");
30 break;
31 }
32 drupal_set_message(t('Role Watchdog table installed. !Configure_role_watchdog', array(
33 '!Configure_role_watchdog' => l('Configure Role Watchdog', 'admin/user/roles/role_watchdog')
34 )));
35 }
36
37 /**
38 * Implementation of hook_uninstall().
39 */
40 function role_watchdog_uninstall() {
41 db_query("DROP TABLE {role_watchdog}");
42 $vars = array(
43 'role_watchdog_monitor_roles',
44 'role_watchdog_notify_roles',
45 'role_watchdog_history',
46 );
47 foreach ($vars as $var) {
48 variable_del($var);
49 }
50 drupal_set_message(t('Role Watchdog table and variables removed.'));
51
52 cache_clear_all();
53 }
54
55 function role_watchdog_update_1() {
56 $items = array();
57 $items[] = update_sql("CREATE TABLE if not exists {role_watchdog} (
58 aid int(10) unsigned NOT NULL,
59 rid int(10) unsigned NOT NULL,
60 action tinyint(1) NOT NULL,
61 uid int(10) unsigned NOT NULL,
62 stamp int(10) unsigned NOT NULL,
63 KEY aid (aid)
64 ) TYPE=MyISAM /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
65
66 return $items;
67 }

  ViewVC Help
Powered by ViewVC 1.1.2