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

Contents of /contributions/modules/game_clock/game_clock.install

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


Revision 1.1 - (show annotations) (download) (as text)
Sun Dec 7 21:31:03 2008 UTC (11 months, 2 weeks ago) by aaron
Branch: MAIN
CVS Tags: HEAD
Branch point for: DRUPAL-6--1
File MIME type: text/x-php
Create initial module (aaron).
1 <?php
2 // $Id$
3
4 /**
5 * @file
6 * The installation file for the Game Clock module.
7 */
8
9 /**
10 * Implementation of hook_install().
11 */
12 function game_clock_install() {
13 $success = drupal_install_schema('game_clock');
14
15 if ($success) {
16 // Insert a starting record.
17 // Note that UI strings in the following SQL, e.g. "Bookmark this", aren't
18 // wrapped in t() and that's intentional: they are passed to t() later,
19 // thus allowing for multilingual sites.
20 db_query("INSERT INTO {game_clocks} (name, title, increment, block) VALUES ('default', 'Default', 5, 1)");
21 }
22
23 if ($success) {
24 drupal_set_message(st('Game Clock module installed tables successfully.'));
25 }
26 else {
27 drupal_set_message(st('The installation of Game Clock module failed.'), 'error');
28 }
29 }
30
31 /**
32 * Implementation of hook_uninstall().
33 */
34 function game_clock_uninstall() {
35 drupal_uninstall_schema('game_clock');
36 $result = db_query("SELECT name FROM {variable} WHERE name LIKE 'game_clock_%'");
37 while ($row = db_fetch_object($result)) {
38 variable_del($row->name);
39 }
40
41 drupal_set_message(t('Game Clock has been uninstalled.'));
42 }
43
44 /**
45 * Implementation of hook_schema().
46 */
47 function game_clock_schema() {
48 $schema = array();
49
50 $schema['game_clocks'] = array(
51 'fields' => array(
52 'cid' => array(
53 'type' => 'serial',
54 'size' => 'small',
55 'unsigned' => TRUE,
56 'not null' => TRUE,
57 ),
58 'name' => array(
59 'type' => 'varchar',
60 'length' => '32',
61 'not null' => FALSE,
62 'default' => '',
63 ),
64 'title' => array(
65 'type' => 'varchar',
66 'length' => '255',
67 'not null' => FALSE,
68 'default' => '',
69 ),
70 'status' => array(
71 'type' => 'int',
72 'size' => 'tiny',
73 'not null' => FALSE,
74 'default' => 0,
75 ),
76 'turn' => array(
77 'type' => 'int',
78 'unsigned' => TRUE,
79 'not null' => TRUE,
80 'default' => 0,
81 'disp-size' => 11,
82 ),
83 'increment' => array(
84 'type' => 'int',
85 'unsigned' => TRUE,
86 'not null' => TRUE,
87 'default' => 0,
88 'disp-size' => 11,
89 ),
90 'next_tick' => array(
91 'type' => 'int',
92 'unsigned' => TRUE,
93 'not null' => TRUE,
94 'default' => 0,
95 'disp-size' => 11,
96 ),
97 'block' => array(
98 'type' => 'int',
99 'size' => 'tiny',
100 'not null' => FALSE,
101 'default' => 0,
102 ),
103 'init' => array(
104 'type' => 'int',
105 'size' => 'tiny',
106 'not null' => FALSE,
107 'default' => 0,
108 ),
109 ),
110 'primary key' => array('cid'),
111 'unique keys' => array(
112 'name' => array('name')
113 ),
114 );
115
116 return $schema;
117 }

  ViewVC Help
Powered by ViewVC 1.1.2