Code coverage for /20081101/modules/block/block.install

Line #Times calledCode
1
<?php
2
// $Id: block.install,v 1.11 2008/05/15 21:30:02 dries Exp $
3
4
/**
5
 * Implementation of hook_schema().
6
 */
712
function block_schema() {
8134
  $schema['blocks'] = array(
9134
    'description' => t('Stores block settings, such as region and
visibility settings.'),
10
    'fields' => array(
11
      'bid' => array(
12134
        'type' => 'serial',
13134
        'not null' => TRUE,
14134
        'description' => t('Primary Key: Unique block ID.'),
15134
      ),
16
      'module' => array(
17134
        'type' => 'varchar',
18134
        'length' => 64,
19134
        'not null' => TRUE,
20134
        'default' => '',
21134
        'description' => t("The module from which the block originates; for
example, 'user' for the Who's Online block, and 'block' for any custom
blocks."),
22134
      ),
23
      'delta' => array(
24134
        'type' => 'varchar',
25134
        'length' => 32,
26134
        'not null' => TRUE,
27134
        'default' => '0',
28134
        'description' => t('Unique ID for block within a module.'),
29134
      ),
30
      'theme' => array(
31134
        'type' => 'varchar',
32134
        'length' => 64,
33134
        'not null' => TRUE,
34134
        'default' => '',
35134
        'description' => t('The theme under which the block settings
apply.'),
36134
      ),
37
      'status' => array(
38134
        'type' => 'int',
39134
        'not null' => TRUE,
40134
        'default' => 0,
41134
        'size' => 'tiny',
42134
        'description' => t('Block enabled status. (1 = enabled, 0 =
disabled)'),
43134
      ),
44
      'weight' => array(
45134
        'type' => 'int',
46134
        'not null' => TRUE,
47134
        'default' => 0,
48134
        'size' => 'tiny',
49134
        'description' => t('Block weight within region.'),
50134
      ),
51
      'region' => array(
52134
        'type' => 'varchar',
53134
        'length' => 64,
54134
        'not null' => TRUE,
55134
        'default' => '',
56134
        'description' => t('Theme region within which the block is set.'),
57134
      ),
58
      'custom' => array(
59134
        'type' => 'int',
60134
        'not null' => TRUE,
61134
        'default' => 0,
62134
        'size' => 'tiny',
63134
        '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)'),
64134
      ),
65
      'visibility' => array(
66134
        'type' => 'int',
67134
        'not null' => TRUE,
68134
        'default' => 0,
69134
        'size' => 'tiny',
70134
        '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)'),
71134
      ),
72
      'pages' => array(
73134
        'type' => 'text',
74134
        'not null' => TRUE,
75134
        '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.'),
76134
      ),
77
      'title' => array(
78134
        'type' => 'varchar',
79134
        'length' => 64,
80134
        'not null' => TRUE,
81134
        'default' => '',
82134
        'description' => t('Custom title for the block. (Empty string will
use block default title, <none> will remove the title, text will cause
block to use specified title.)'),
83134
      ),
84
      'cache' => array(
85134
        'type' => 'int',
86134
        'not null' => TRUE,
87134
        'default' => 1,
88134
        'size' => 'tiny',
89134
        '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.'),
90134
      ),
91134
    ),
92134
    'primary key' => array('bid'),
93
    'unique keys' => array(
94134
      'tmd' => array('theme', 'module', 'delta'),
95134
    ),
96
    'indexes' => array(
97134
      'list' => array('theme', 'status', 'region', 'weight', 'module'),
98134
    ),
99
  );
100
101134
  $schema['blocks_roles'] = array(
102134
    'description' => t('Sets up access permissions for blocks based on user
roles'),
103
    'fields' => array(
104
      'module' => array(
105134
        'type' => 'varchar',
106134
        'length' => 64,
107134
        'not null' => TRUE,
108134
        'description' => t("The block's origin module, from
{blocks}.module."),
109134
      ),
110
      'delta' => array(
111134
        'type' => 'varchar',
112134
        'length' => 32,
113134
        'not null' => TRUE,
114134
        'description' => t("The block's unique delta within module, from
{blocks}.delta."),
115134
      ),
116
      'rid' => array(
117134
        'type' => 'int',
118134
        'unsigned' => TRUE,
119134
        'not null' => TRUE,
120134
        'description' => t("The user's role ID from {users_roles}.rid."),
121134
      ),
122134
    ),
123134
    'primary key' => array('module', 'delta', 'rid'),
124
    'indexes' => array(
125134
      'rid' => array('rid'),
126134
    ),
127
  );
128
129134
  $schema['boxes'] = array(
130134
    'description' => t('Stores contents of custom-made blocks.'),
131
    'fields' => array(
132
      'bid' => array(
133134
        'type' => 'serial',
134134
        'unsigned' => TRUE,
135134
        'not null' => TRUE,
136134
        'description' => t("The block's {blocks}.bid."),
137134
      ),
138
      'body' => array(
139134
        'type' => 'text',
140134
        'not null' => FALSE,
141134
        'size' => 'big',
142134
        'description' => t('Block contents.'),
143134
      ),
144
      'info' => array(
145134
        'type' => 'varchar',
146134
        'length' => 128,
147134
        'not null' => TRUE,
148134
        'default' => '',
149134
        'description' => t('Block description.'),
150134
      ),
151
      'format' => array(
152134
        'type' => 'int',
153134
        'size' => 'small',
154134
        'not null' => TRUE,
155134
        'default' => 0,
156134
        'description' => t("Block body's {filter_formats}.format; for
example, 1 = Filtered HTML."),
157
      )
158134
    ),
159
    'unique keys' => array(
160134
      'info' => array('info'),
161134
    ),
162134
    'primary key' => array('bid'),
163
  );
164
165134
  $schema['cache_block'] = drupal_get_schema_unprocessed('system',
'cache');
166134
  $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.');
167
168134
  return $schema;
1690
}
17012