| 1 |
<?php
|
| 2 |
// $Id: path_image.install,v 1.4 2009/01/28 14:47:48 sun Exp $
|
| 3 |
|
| 4 |
/**
|
| 5 |
* @file
|
| 6 |
* Module installation and update functionality for Path image.
|
| 7 |
*/
|
| 8 |
|
| 9 |
/**
|
| 10 |
* Implementation of hook_schema().
|
| 11 |
*/
|
| 12 |
function path_image_schema() {
|
| 13 |
$schema['path_image_data'] = array(
|
| 14 |
'fields' => array(
|
| 15 |
'pid' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE),
|
| 16 |
'path' => array('type' => 'varchar', 'length' => '128', 'not null' => FALSE),
|
| 17 |
'image_file' => array('type' => 'varchar', 'length' => '32', 'not null' => FALSE),
|
| 18 |
),
|
| 19 |
'indexes' => array(
|
| 20 |
'path' => array(array('path', 32)),
|
| 21 |
),
|
| 22 |
'primary key' => array('pid'),
|
| 23 |
);
|
| 24 |
return $schema;
|
| 25 |
}
|
| 26 |
|
| 27 |
/**
|
| 28 |
* Implementation of hook_install().
|
| 29 |
*/
|
| 30 |
function path_image_install() {
|
| 31 |
drupal_install_schema('path_image');
|
| 32 |
db_query("UPDATE {system} SET weight = 5 WHERE name = 'path_image'");
|
| 33 |
}
|
| 34 |
|
| 35 |
/**
|
| 36 |
* Implementation of hook_uninstall().
|
| 37 |
*/
|
| 38 |
function path_image_uninstall() {
|
| 39 |
drupal_uninstall_schema('path_image');
|
| 40 |
variable_del('path_image_block_subject');
|
| 41 |
variable_del('path_image_default_image');
|
| 42 |
variable_del('path_image_default_use');
|
| 43 |
variable_del('path_image_file_types');
|
| 44 |
variable_del('path_image_homepage_image');
|
| 45 |
variable_del('path_image_homepage_use');
|
| 46 |
variable_del('path_image_numeric_use');
|
| 47 |
variable_del('path_image_repository');
|
| 48 |
}
|
| 49 |
|
| 50 |
/**
|
| 51 |
* Convert column 'pid' into type serial.
|
| 52 |
*/
|
| 53 |
function path_image_update_6100() {
|
| 54 |
$ret = array();
|
| 55 |
db_drop_primary_key($ret, 'path_image_data');
|
| 56 |
db_change_field($ret, 'path_image_data', 'pid', 'pid', array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE), array('primary key' => array('pid')));
|
| 57 |
return $ret;
|
| 58 |
}
|
| 59 |
|