comparison modules/block/block.install @ 19:3edae6ecd6c6 6.9

Drupal 6.9
author Franck Deroche <franck@defr.org>
date Thu, 15 Jan 2009 10:15:56 +0100
parents 4347c45bb494
children
comparison
equal deleted inserted replaced
18:f5131a9cd9e5 19:3edae6ecd6c6
1 <?php 1 <?php
2 // $Id: block.install,v 1.8.2.1 2008/11/09 13:22:35 goba Exp $ 2 // $Id: block.install,v 1.8.2.2 2009/01/06 15:46:36 goba Exp $
3 3
4 /** 4 /**
5 * Implementation of hook_schema(). 5 * Implementation of hook_schema().
6 */ 6 */
7 function block_schema() { 7 function block_schema() {
8 $schema['blocks'] = array( 8 $schema['blocks'] = array(
9 'description' => t('Stores block settings, such as region and visibility settings.'), 9 'description' => 'Stores block settings, such as region and visibility settings.',
10 'fields' => array( 10 'fields' => array(
11 'bid' => array( 11 'bid' => array(
12 'type' => 'serial', 12 'type' => 'serial',
13 'not null' => TRUE, 13 'not null' => TRUE,
14 'description' => t('Primary Key: Unique block ID.'), 14 'description' => 'Primary Key: Unique block ID.',
15 ), 15 ),
16 'module' => array( 16 'module' => array(
17 'type' => 'varchar', 17 'type' => 'varchar',
18 'length' => 64, 18 'length' => 64,
19 'not null' => TRUE, 19 'not null' => TRUE,
20 'default' => '', 20 'default' => '',
21 'description' => t("The module from which the block originates; for example, 'user' for the Who's Online block, and 'block' for any custom blocks."), 21 'description' => "The module from which the block originates; for example, 'user' for the Who's Online block, and 'block' for any custom blocks.",
22 ), 22 ),
23 'delta' => array( 23 'delta' => array(
24 'type' => 'varchar', 24 'type' => 'varchar',
25 'length' => 32, 25 'length' => 32,
26 'not null' => TRUE, 26 'not null' => TRUE,
27 'default' => '0', 27 'default' => '0',
28 'description' => t('Unique ID for block within a module.'), 28 'description' => 'Unique ID for block within a module.',
29 ), 29 ),
30 'theme' => array( 30 'theme' => array(
31 'type' => 'varchar', 31 'type' => 'varchar',
32 'length' => 64, 32 'length' => 64,
33 'not null' => TRUE, 33 'not null' => TRUE,
34 'default' => '', 34 'default' => '',
35 'description' => t('The theme under which the block settings apply.'), 35 'description' => 'The theme under which the block settings apply.',
36 ), 36 ),
37 'status' => array( 37 'status' => array(
38 'type' => 'int', 38 'type' => 'int',
39 'not null' => TRUE, 39 'not null' => TRUE,
40 'default' => 0, 40 'default' => 0,
41 'size' => 'tiny', 41 'size' => 'tiny',
42 'description' => t('Block enabled status. (1 = enabled, 0 = disabled)'), 42 'description' => 'Block enabled status. (1 = enabled, 0 = disabled)',
43 ), 43 ),
44 'weight' => array( 44 'weight' => array(
45 'type' => 'int', 45 'type' => 'int',
46 'not null' => TRUE, 46 'not null' => TRUE,
47 'default' => 0, 47 'default' => 0,
48 'size' => 'tiny', 48 'size' => 'tiny',
49 'description' => t('Block weight within region.'), 49 'description' => 'Block weight within region.',
50 ), 50 ),
51 'region' => array( 51 'region' => array(
52 'type' => 'varchar', 52 'type' => 'varchar',
53 'length' => 64, 53 'length' => 64,
54 'not null' => TRUE, 54 'not null' => TRUE,
55 'default' => '', 55 'default' => '',
56 'description' => t('Theme region within which the block is set.'), 56 'description' => 'Theme region within which the block is set.',
57 ), 57 ),
58 'custom' => array( 58 'custom' => array(
59 'type' => 'int', 59 'type' => 'int',
60 'not null' => TRUE, 60 'not null' => TRUE,
61 'default' => 0, 61 'default' => 0,
62 'size' => 'tiny', 62 'size' => 'tiny',
63 'description' => t('Flag to indicate how users may control visibility of the block. (0 = Users cannot control, 1 = On by default, but can be hidden, 2 = Hidden by default, but can be shown)'), 63 'description' => 'Flag to indicate how users may control visibility of the block. (0 = Users cannot control, 1 = On by default, but can be hidden, 2 = Hidden by default, but can be shown)',
64 ), 64 ),
65 'throttle' => array( 65 'throttle' => array(
66 'type' => 'int', 66 'type' => 'int',
67 'not null' => TRUE, 67 'not null' => TRUE,
68 'default' => 0, 68 'default' => 0,
69 'size' => 'tiny', 69 'size' => 'tiny',
70 'description' => t('Flag to indicate whether or not to remove block when website traffic is high. (1 = throttle, 0 = do not throttle)'), 70 'description' => 'Flag to indicate whether or not to remove block when website traffic is high. (1 = throttle, 0 = do not throttle)',
71 ), 71 ),
72 'visibility' => array( 72 'visibility' => array(
73 'type' => 'int', 73 'type' => 'int',
74 'not null' => TRUE, 74 'not null' => TRUE,
75 'default' => 0, 75 'default' => 0,
76 'size' => 'tiny', 76 'size' => 'tiny',
77 'description' => t('Flag to indicate how to show blocks on pages. (0 = Show on all pages except listed pages, 1 = Show only on listed pages, 2 = Use custom PHP code to determine visibility)'), 77 'description' => 'Flag to indicate how to show blocks on pages. (0 = Show on all pages except listed pages, 1 = Show only on listed pages, 2 = Use custom PHP code to determine visibility)',
78 ), 78 ),
79 'pages' => array( 79 'pages' => array(
80 'type' => 'text', 80 'type' => 'text',
81 'not null' => TRUE, 81 'not null' => TRUE,
82 'description' => t('Contents of the "Pages" block; contains either a list of paths on which to include/exclude the block or PHP code, depending on "visibility" setting.'), 82 'description' => 'Contents of the "Pages" block; contains either a list of paths on which to include/exclude the block or PHP code, depending on "visibility" setting.',
83 ), 83 ),
84 'title' => array( 84 'title' => array(
85 'type' => 'varchar', 85 'type' => 'varchar',
86 'length' => 64, 86 'length' => 64,
87 'not null' => TRUE, 87 'not null' => TRUE,
88 'default' => '', 88 'default' => '',
89 'description' => t('Custom title for the block. (Empty string will use block default title, &lt;none&gt; will remove the title, text will cause block to use specified title.)'), 89 'description' => 'Custom title for the block. (Empty string will use block default title, &lt;none&gt; will remove the title, text will cause block to use specified title.)',
90 ), 90 ),
91 'cache' => array( 91 'cache' => array(
92 'type' => 'int', 92 'type' => 'int',
93 'not null' => TRUE, 93 'not null' => TRUE,
94 'default' => 1, 94 'default' => 1,
95 'size' => 'tiny', 95 'size' => 'tiny',
96 'description' => t('Binary flag to indicate block cache mode. (-1: Do not cache, 1: Cache per role, 2: Cache per user, 4: Cache per page, 8: Block cache global) See BLOCK_CACHE_* constants in block.module for more detailed information.'), 96 'description' => 'Binary flag to indicate block cache mode. (-1: Do not cache, 1: Cache per role, 2: Cache per user, 4: Cache per page, 8: Block cache global) See BLOCK_CACHE_* constants in block.module for more detailed information.',
97 ), 97 ),
98 ), 98 ),
99 'primary key' => array('bid'), 99 'primary key' => array('bid'),
100 'unique keys' => array( 100 'unique keys' => array(
101 'tmd' => array('theme', 'module', 'delta'), 101 'tmd' => array('theme', 'module', 'delta'),
104 'list' => array('theme', 'status', 'region', 'weight', 'module'), 104 'list' => array('theme', 'status', 'region', 'weight', 'module'),
105 ), 105 ),
106 ); 106 );
107 107
108 $schema['blocks_roles'] = array( 108 $schema['blocks_roles'] = array(
109 'description' => t('Sets up access permissions for blocks based on user roles'), 109 'description' => 'Sets up access permissions for blocks based on user roles',
110 'fields' => array( 110 'fields' => array(
111 'module' => array( 111 'module' => array(
112 'type' => 'varchar', 112 'type' => 'varchar',
113 'length' => 64, 113 'length' => 64,
114 'not null' => TRUE, 114 'not null' => TRUE,
115 'description' => t("The block's origin module, from {blocks}.module."), 115 'description' => "The block's origin module, from {blocks}.module.",
116 ), 116 ),
117 'delta' => array( 117 'delta' => array(
118 'type' => 'varchar', 118 'type' => 'varchar',
119 'length' => 32, 119 'length' => 32,
120 'not null' => TRUE, 120 'not null' => TRUE,
121 'description' => t("The block's unique delta within module, from {blocks}.delta."), 121 'description' => "The block's unique delta within module, from {blocks}.delta.",
122 ), 122 ),
123 'rid' => array( 123 'rid' => array(
124 'type' => 'int', 124 'type' => 'int',
125 'unsigned' => TRUE, 125 'unsigned' => TRUE,
126 'not null' => TRUE, 126 'not null' => TRUE,
127 'description' => t("The user's role ID from {users_roles}.rid."), 127 'description' => "The user's role ID from {users_roles}.rid.",
128 ), 128 ),
129 ), 129 ),
130 'primary key' => array( 130 'primary key' => array(
131 'module', 131 'module',
132 'delta', 132 'delta',
136 'rid' => array('rid'), 136 'rid' => array('rid'),
137 ), 137 ),
138 ); 138 );
139 139
140 $schema['boxes'] = array( 140 $schema['boxes'] = array(
141 'description' => t('Stores contents of custom-made blocks.'), 141 'description' => 'Stores contents of custom-made blocks.',
142 'fields' => array( 142 'fields' => array(
143 'bid' => array( 143 'bid' => array(
144 'type' => 'serial', 144 'type' => 'serial',
145 'unsigned' => TRUE, 145 'unsigned' => TRUE,
146 'not null' => TRUE, 146 'not null' => TRUE,
147 'description' => t("The block's {blocks}.bid."), 147 'description' => "The block's {blocks}.bid.",
148 ), 148 ),
149 'body' => array( 149 'body' => array(
150 'type' => 'text', 150 'type' => 'text',
151 'not null' => FALSE, 151 'not null' => FALSE,
152 'size' => 'big', 152 'size' => 'big',
153 'description' => t('Block contents.'), 153 'description' => 'Block contents.',
154 ), 154 ),
155 'info' => array( 155 'info' => array(
156 'type' => 'varchar', 156 'type' => 'varchar',
157 'length' => 128, 157 'length' => 128,
158 'not null' => TRUE, 158 'not null' => TRUE,
159 'default' => '', 159 'default' => '',
160 'description' => t('Block description.'), 160 'description' => 'Block description.',
161 ), 161 ),
162 'format' => array( 162 'format' => array(
163 'type' => 'int', 163 'type' => 'int',
164 'size' => 'small', 164 'size' => 'small',
165 'not null' => TRUE, 165 'not null' => TRUE,
166 'default' => 0, 166 'default' => 0,
167 'description' => t("Block body's {filter_formats}.format; for example, 1 = Filtered HTML."), 167 'description' => "Block body's {filter_formats}.format; for example, 1 = Filtered HTML.",
168 ) 168 )
169 ), 169 ),
170 'unique keys' => array('info' => array('info')), 170 'unique keys' => array('info' => array('info')),
171 'primary key' => array('bid'), 171 'primary key' => array('bid'),
172 ); 172 );
173 173
174 $schema['cache_block'] = drupal_get_schema_unprocessed('system', 'cache'); 174 $schema['cache_block'] = drupal_get_schema_unprocessed('system', 'cache');
175 $schema['cache_block']['description'] = t('Cache table for the Block module to store already built blocks, identified by module, delta, and various contexts which may change the block, such as theme, locale, and caching mode defined for the block.'); 175 $schema['cache_block']['description'] = 'Cache table for the Block module to store already built blocks, identified by module, delta, and various contexts which may change the block, such as theme, locale, and caching mode defined for the block.';
176 176
177 return $schema; 177 return $schema;
178 } 178 }
179 179