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

Contents of /contributions/modules/dodge/dodge.install

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


Revision 1.11 - (show annotations) (download) (as text)
Fri Apr 18 13:42:49 2008 UTC (19 months, 1 week ago) by davyvandenbremt
Branch: MAIN
CVS Tags: HEAD
Changes since 1.10: +3 -1 lines
File MIME type: text/x-php
- small bug fixes
- changed theme function name for blocks
- added page with all dodges of a certain user
- added links to blocks for 'users' to all all user's dodges
1 <?php
2 // $Id: dodge.install,v 1.10 2008/04/18 12:12:54 davyvandenbremt Exp $
3
4 /**
5 * @file
6 * Dodge module.
7 *
8 * Install file.
9 */
10
11 require_once 'dodge.inc';
12
13 /**
14 * Implementation of hook_install().
15 */
16 function dodge_install() {
17 switch ($GLOBALS['db_type']) {
18 case 'mysql':
19 case 'mysqli':
20 db_query("
21 CREATE TABLE {dodge} (
22 uid INT NOT NULL,
23 dodge VARCHAR(%d) DEFAULT '' NOT NULL,
24 free_dodge VARCHAR(%d) NULL,
25 forced_dodge INT NULL,
26 age INT NOT NULL,
27 time INT NOT NULL
28 ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ",
29 DODGE_MAX_DODGE_LENGTH,
30 DODGE_MAX_DODGE_LENGTH);
31 db_query("
32 CREATE TABLE {dodge_options} (
33 did INT NOT NULL,
34 dodge VARCHAR(160) DEFAULT '' NOT NULL
35 ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
36 // The following is necessary because the id for "free dodge" is 1.
37 db_query("
38 INSERT INTO {sequences} (
39 name,
40 id
41 ) VALUES (
42 'dodge_options_did',
43 1
44 )");
45 break;
46 case 'pgsql':
47 // TODO: need someone to do this on PostgreSQL
48 break;
49 }
50
51 drupal_set_message(t("The Dodge module was installed. Dodge settings are available under !link",
52 array( '!link' => l('Administer > Site configuration > Dodge ', 'admin/settings/dodge/settings' ) )
53 ));
54 }
55
56 /**
57 * Implementation of hook_uninstall().
58 */
59 function dodge_uninstall() {
60 db_query("DROP TABLE {dodge}");
61 db_query("DROP TABLE {dodge_options}");
62 db_query("DELETE FROM {variable} WHERE name LIKE 'dodge_%'");
63 db_query("DELETE FROM {sequences} WHERE name = 'dodge_options_did'");
64 db_query("DELETE FROM {blocks} WHERE module = 'dodge'");
65 db_query("TRUNCATE TABLE {cache_menu}");
66 variable_del('dodge_max_log_size');
67 variable_del('dodge_allow_free_dodge');
68 variable_del('dodge_expire');
69 variable_del('dodge_block_limit_popular_dodges');
70 variable_del('dodge_block_limit_recent_dodges');
71 variable_del('dodge_block_limit_history_of_user');
72 variable_del('dodge_block_limit_history_of_current_user');
73 variable_del('dodge_block_no_dodgepopular_dodges');
74 variable_del('dodge_block_no_dodgerecent_dodges');
75 variable_del('dodge_block_all_dodgespopular_dodges');
76 variable_del('dodge_block_all_dodgesrecent_dodges');
77 variable_del('dodge_block_all_dodgeshistory_of_user');
78 variable_del('dodge_block_all_dodgeshistory_of_current_user');
79 variable_del('dodge_block_no_dodgehistory_of_user');
80 variable_del('dodge_block_no_dodgehistory_of_current_user');
81 variable_del('dodge_allow_free_dodge');
82 }

  ViewVC Help
Powered by ViewVC 1.1.2