Newer
Older
<?php
// $Id$
Addison Berry
committed
/**
* Implementation of hook_install().
*/
function css_injector_install() {
drupal_install_schema('css_injector');
}
Addison Berry
committed
/**
* Implementation of hook_schema().
*/
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
function css_injector_schema() {
$schema['css_injector_rule'] = array(
'fields' => array(
'crid' => array(
'description' => 'The primary identifier for the CSS injection rule',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE),
'title' => array(
'description' => 'The descriptive title of the CSS injection rule',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE),
'rule_type' => array(
'description' => 'The type of rule to use when determining if the CSS should be injected',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0),
'rule_conditions' => array(
'description' => 'The data to evaluate when determining if the CSS should be injected',
'type' => 'text',
'not null' => TRUE),
'media' => array(
'description' => 'The media type of the CSS file (screen, print, etc.)',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE),
'preprocess' => array(
'description' => 'Whether the CSS file should be included by the CSS preprocessor',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0),
),
'primary key' => array('crid'),
);
return $schema;
}
Addison Berry
committed
/**
* Implementation of hook_uninstall().
*/
function css_injector_uninstall() {
cache_clear_all('css_injector:*', 'cache', TRUE);
$results = db_query("SELECT * FROM {css_injector_rule}");
while ($rule = db_fetch_array($results)) {
file_delete(file_create_path($rule['file_path']));
}
db_query("DROP TABLE {css_injector_rule}");
Addison Berry
committed
}