| 1 |
<?php
|
| 2 |
|
| 3 |
function registry_schema() {
|
| 4 |
$schema['registry'] = array(
|
| 5 |
'description' => t('The index of loadable code in the system.'),
|
| 6 |
'fields' => array(
|
| 7 |
'name' => array(
|
| 8 |
'description' => t('The name of the function or class.'),
|
| 9 |
'type' => 'varchar',
|
| 10 |
'length' => 255,
|
| 11 |
'not null' => TRUE
|
| 12 |
),
|
| 13 |
'type' => array(
|
| 14 |
'description' => t('The type of code being saved (function, class, etc.).'),
|
| 15 |
'type' => 'varchar',
|
| 16 |
'length' => 25,
|
| 17 |
'not null' => TRUE,
|
| 18 |
),
|
| 19 |
'grouping' => array(
|
| 20 |
'description' => t('The "group" in which this code resides. The group is defined as the second part of the file name.'),
|
| 21 |
'type' => 'varchar',
|
| 22 |
'length' => 25,
|
| 23 |
'not null' => TRUE,
|
| 24 |
),
|
| 25 |
'file' => array(
|
| 26 |
'description' => t('The file in which this code resides.'),
|
| 27 |
'type' => 'varchar',
|
| 28 |
'length' => 255,
|
| 29 |
'not null' => TRUE,
|
| 30 |
),
|
| 31 |
),
|
| 32 |
'indexes' => array(
|
| 33 |
'registry_name' => array('name'),
|
| 34 |
'registry_grouping' => array('grouping'),
|
| 35 |
),
|
| 36 |
'unique keys' => array(
|
| 37 |
'names' => array('name'),
|
| 38 |
),
|
| 39 |
'primary key' => array('name'),
|
| 40 |
);
|
| 41 |
return $schema;
|
| 42 |
}
|
| 43 |
|
| 44 |
function registry_install() {
|
| 45 |
// Create my tables.
|
| 46 |
drupal_install_schema('registry');
|
| 47 |
|
| 48 |
// Initialize the registry.
|
| 49 |
drupal_load('module', 'registry');
|
| 50 |
registry_rebuild();
|
| 51 |
}
|
| 52 |
|
| 53 |
function registry_uninstall() {
|
| 54 |
// Drop my tables.
|
| 55 |
drupal_uninstall_schema('registry');
|
| 56 |
}
|