| 1 |
<?php
|
| 2 |
// $Id: img_assist.install,v 1.7 2008/07/18 22:58:09 sun Exp $
|
| 3 |
|
| 4 |
|
| 5 |
/**
|
| 6 |
* Implementation of hook_schema().
|
| 7 |
*/
|
| 8 |
function img_assist_schema() {
|
| 9 |
$schema['img_assist_map'] = array(
|
| 10 |
'description' => t('Stores references of image files to content.'),
|
| 11 |
'fields' => array(
|
| 12 |
'nid' => array(
|
| 13 |
'description' => t('The {node}.nid of the content referencing the image file.'),
|
| 14 |
'type' => 'int',
|
| 15 |
'unsigned' => TRUE,
|
| 16 |
'not null' => TRUE,
|
| 17 |
'default' => 0,
|
| 18 |
),
|
| 19 |
'iid' => array(
|
| 20 |
'description' => t('The {image}.nid of the image file referenced by the content.'),
|
| 21 |
'type' => 'int',
|
| 22 |
'unsigned' => TRUE,
|
| 23 |
'not null' => TRUE,
|
| 24 |
'default' => 0,
|
| 25 |
),
|
| 26 |
),
|
| 27 |
'primary key' => array('nid', 'iid'),
|
| 28 |
);
|
| 29 |
return $schema;
|
| 30 |
}
|
| 31 |
|
| 32 |
/**
|
| 33 |
* Implementation of hook_install().
|
| 34 |
*/
|
| 35 |
function img_assist_install() {
|
| 36 |
drupal_install_schema('img_assist');
|
| 37 |
}
|
| 38 |
|
| 39 |
/**
|
| 40 |
* Implementation of hook_uninstall().
|
| 41 |
*/
|
| 42 |
function img_assist_uninstall() {
|
| 43 |
drupal_uninstall_schema('img_assist');
|
| 44 |
|
| 45 |
variable_del('img_assist_page_styling');
|
| 46 |
variable_del('img_assist_link');
|
| 47 |
variable_del('img_assist_all');
|
| 48 |
variable_del('img_assist_pages');
|
| 49 |
variable_del('img_assist_link');
|
| 50 |
variable_del('img_assist_preview_count');
|
| 51 |
variable_del('img_assist_max_size');
|
| 52 |
variable_del('img_assist_popup_label');
|
| 53 |
variable_del('img_assist_default_label');
|
| 54 |
variable_del('img_assist_create_derivatives');
|
| 55 |
variable_del('img_assist_default_link_behavior');
|
| 56 |
variable_del('img_assist_default_link_url');
|
| 57 |
variable_del('img_assist_default_insert_mode');
|
| 58 |
variable_del('img_assist_load_title');
|
| 59 |
variable_del('img_assist_load_description');
|
| 60 |
variable_del('img_assist_vocabs');
|
| 61 |
variable_del('img_assist_default_alignment');
|
| 62 |
variable_del('img_assist_all');
|
| 63 |
}
|
| 64 |
|
| 65 |
/**
|
| 66 |
* Remove obsolete img_assist_preview_count variable.
|
| 67 |
* Disable Image assist if Views is not installed/enabled.
|
| 68 |
*/
|
| 69 |
function img_assist_update_6200() {
|
| 70 |
$ret = array();
|
| 71 |
variable_del('img_assist_preview_count');
|
| 72 |
if (!module_exists('views')) {
|
| 73 |
db_query("UPDATE {system} SET status = %d WHERE type = '%s' AND name = '%s'", 0, 'module', 'img_assist');
|
| 74 |
drupal_set_message('Image assist has been disabled, because it requires <a href="http://drupal.org/project/views">Views</a> module to be installed.', 'error');
|
| 75 |
}
|
| 76 |
return $ret;
|
| 77 |
}
|
| 78 |
|