| 1 |
<?php
|
| 2 |
// $Id: bloginfo.install,v 1.5 2007/06/22 00:56:54 mfer Exp $
|
| 3 |
/**
|
| 4 |
* @file
|
| 5 |
* The Blog title and description module.
|
| 6 |
*
|
| 7 |
*/
|
| 8 |
|
| 9 |
/* Installing bloginfo */
|
| 10 |
function bloginfo_install() {
|
| 11 |
$result = drupal_install_schema('bloginfo');
|
| 12 |
|
| 13 |
if ($result[0]['success'] == 1) {
|
| 14 |
drupal_set_message(t('Bloginfo module installed succesfully.'));
|
| 15 |
}
|
| 16 |
else {
|
| 17 |
drupal_set_message(t('Bloginfo module installation was unsuccesfull. The necessary database table may be created by hand. See the "README.txt" file in the "bloginfo/" modules directory for instructions.', 'error'));
|
| 18 |
}
|
| 19 |
}
|
| 20 |
|
| 21 |
/**
|
| 22 |
* Implementation of hook_schema().
|
| 23 |
*/
|
| 24 |
function bloginfo_schema() {
|
| 25 |
$schema['bloginfo'] = array(
|
| 26 |
'description' => t('This holds the bloginfo data.'),
|
| 27 |
'fields' => array(
|
| 28 |
'uid' => array(
|
| 29 |
'type' => 'int',
|
| 30 |
'unsigned' => TRUE,
|
| 31 |
'not null' => TRUE,
|
| 32 |
),
|
| 33 |
'title' => array(
|
| 34 |
'type' => 'varchar',
|
| 35 |
'length' => 128,
|
| 36 |
'not null' => TRUE,
|
| 37 |
),
|
| 38 |
'description' => array(
|
| 39 |
'type' => 'text',
|
| 40 |
'not null' => TRUE,
|
| 41 |
),
|
| 42 |
'format' => array(
|
| 43 |
'type' => 'int',
|
| 44 |
'unsigned' => TRUE,
|
| 45 |
'not null' => TRUE,
|
| 46 |
'default' => 0,
|
| 47 |
),
|
| 48 |
),
|
| 49 |
'primary key' => array('uid'),
|
| 50 |
);
|
| 51 |
|
| 52 |
return $schema;
|
| 53 |
|
| 54 |
}
|
| 55 |
|
| 56 |
/**
|
| 57 |
* Implementation of hook_uninstall().
|
| 58 |
*/
|
| 59 |
function bloginfo_uninstall() {
|
| 60 |
drupal_uninstall_schema('bloginfo');
|
| 61 |
}
|
| 62 |
|
| 63 |
function bloginfo_update_1() {
|
| 64 |
$ret = array();
|
| 65 |
|
| 66 |
db_add_field($ret, 'bloginfo', 'format', array('type' => 'int', 'not null' => TRUE, 'default' => 0));
|
| 67 |
|
| 68 |
return $ret;
|
| 69 |
}
|
| 70 |
|
| 71 |
function bloginfo_update_2() {
|
| 72 |
$ret = array();
|
| 73 |
|
| 74 |
db_change_field($ret, 'bloginfo', 'uid', 'uid', array('type' => 'int', 'not null' => TRUE));
|
| 75 |
|
| 76 |
return $ret;
|
| 77 |
}
|