| 1 |
<?php
|
| 2 |
// $Id: headerimage.install,v 1.6 2008/07/26 13:29:37 sutharsan Exp $
|
| 3 |
|
| 4 |
/**
|
| 5 |
* Implementation of hook_schema()
|
| 6 |
*/
|
| 7 |
function headerimage_schema() {
|
| 8 |
$schema['headerimage'] = array(
|
| 9 |
'description' => t(''),
|
| 10 |
'fields' => array(
|
| 11 |
'nid' => array(
|
| 12 |
'description' => t(''),
|
| 13 |
'type' => 'int',
|
| 14 |
'unsigned' => TRUE,
|
| 15 |
'not null' => TRUE,
|
| 16 |
'default' => 0,
|
| 17 |
),
|
| 18 |
'block' => array(
|
| 19 |
'description' => t(''),
|
| 20 |
'type' => 'varchar',
|
| 21 |
'length' => 32,
|
| 22 |
'not null' => TRUE,
|
| 23 |
'default' => '0',
|
| 24 |
),
|
| 25 |
'weight' => array(
|
| 26 |
'description' => t(''),
|
| 27 |
'type' => 'int',
|
| 28 |
'size' => 'tiny',
|
| 29 |
'not null' => TRUE,
|
| 30 |
'default' => 0,
|
| 31 |
),
|
| 32 |
'conditions' => array(
|
| 33 |
'description' => t(''),
|
| 34 |
'type' => 'text',
|
| 35 |
'not null' => TRUE,
|
| 36 |
),
|
| 37 |
),
|
| 38 |
'primary key' => array('nid'),
|
| 39 |
);
|
| 40 |
$schema['headerimage_block'] = array(
|
| 41 |
'description' => t(''),
|
| 42 |
'fields' => array(
|
| 43 |
'delta' => array(
|
| 44 |
'description' => t(''),
|
| 45 |
'type' => 'serial',
|
| 46 |
'unsigned' => TRUE,
|
| 47 |
'not null' => TRUE,
|
| 48 |
),
|
| 49 |
'title' => array(
|
| 50 |
'description' => t(''),
|
| 51 |
'type' => 'varchar',
|
| 52 |
'length' => 64,
|
| 53 |
'not null' => TRUE,
|
| 54 |
'default' => '',
|
| 55 |
),
|
| 56 |
),
|
| 57 |
'primary key' => array('delta'),
|
| 58 |
);
|
| 59 |
|
| 60 |
return $schema;
|
| 61 |
}
|
| 62 |
|
| 63 |
/**
|
| 64 |
* Implementation of hook_install
|
| 65 |
*/
|
| 66 |
function headerimage_install() {
|
| 67 |
if (drupal_install_schema('headerimage')) {
|
| 68 |
drupal_set_message(t('Header Image module installed successfully.'));
|
| 69 |
}
|
| 70 |
else {
|
| 71 |
drupal_set_message(t('The installation of the Header Image module was unsuccessful.'), 'error');
|
| 72 |
}
|
| 73 |
}
|
| 74 |
|
| 75 |
/**
|
| 76 |
* Implementation of hook_uninstall
|
| 77 |
*/
|
| 78 |
function headerimage_uninstall() {
|
| 79 |
drupal_uninstall_schema('headerimage');
|
| 80 |
db_query("DELETE FROM {variable} WHERE name LIKE 'headerimage_%%'");
|
| 81 |
}
|
| 82 |
|
| 83 |
/**
|
| 84 |
* Change weight field to unsigned int.
|
| 85 |
*/
|
| 86 |
function headerimage_update_6001() {
|
| 87 |
$ret = array();
|
| 88 |
db_change_field($ret, 'headerimage', 'weight', 'weight', array(
|
| 89 |
'description' => t(''),
|
| 90 |
'type' => 'int',
|
| 91 |
'size' => 'tiny',
|
| 92 |
'not null' => TRUE,
|
| 93 |
'default' => 0,
|
| 94 |
)
|
| 95 |
);
|
| 96 |
return $ret;
|
| 97 |
}
|
| 98 |
|
| 99 |
/**
|
| 100 |
* Remove default from field conditions.
|
| 101 |
*/
|
| 102 |
function headerimage_update_6002() {
|
| 103 |
$ret = array();
|
| 104 |
db_change_field($ret, 'headerimage', 'conditions', 'conditions', array(
|
| 105 |
'description' => t(''),
|
| 106 |
'type' => 'text',
|
| 107 |
'not null' => TRUE,
|
| 108 |
)
|
| 109 |
);
|
| 110 |
return $ret;
|
| 111 |
}
|
| 112 |
|