You are here

img_assist.install in Image Assist 6.2

File

img_assist.install
View source
<?php

/**
 * Implementation of hook_schema().
 */
function img_assist_schema() {
  $schema['img_assist_map'] = array(
    'description' => t('Stores references of image files to content.'),
    'fields' => array(
      'nid' => array(
        'description' => t('The {node}.nid of the content referencing the image file.'),
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'iid' => array(
        'description' => t('The {image}.nid of the image file referenced by the content.'),
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'nid',
      'iid',
    ),
  );
  return $schema;
}

/**
 * Implementation of hook_install().
 */
function img_assist_install() {
  drupal_install_schema('img_assist');
}

/**
 * Implementation of hook_uninstall().
 */
function img_assist_uninstall() {
  drupal_uninstall_schema('img_assist');
  variable_del('img_assist_page_styling');
  variable_del('img_assist_link');
  variable_del('img_assist_all');
  variable_del('img_assist_pages');
  variable_del('img_assist_link');
  variable_del('img_assist_preview_count');
  variable_del('img_assist_max_size');
  variable_del('img_assist_popup_label');
  variable_del('img_assist_default_label');
  variable_del('img_assist_create_derivatives');
  variable_del('img_assist_default_link_behavior');
  variable_del('img_assist_default_link_url');
  variable_del('img_assist_default_insert_mode');
  variable_del('img_assist_load_title');
  variable_del('img_assist_load_description');
  variable_del('img_assist_vocabs');
  variable_del('img_assist_default_alignment');
  variable_del('img_assist_all');
}

/**
 * Remove obsolete img_assist_preview_count variable.
 * Disable Image assist if Views is not installed/enabled.
 */
function img_assist_update_6200() {
  $ret = array();
  variable_del('img_assist_preview_count');
  if (!module_exists('views')) {
    db_query("UPDATE {system} SET status = %d WHERE type = '%s' AND name = '%s'", 0, 'module', 'img_assist');
    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');
  }
  return $ret;
}

Functions

Namesort descending Description
img_assist_install Implementation of hook_install().
img_assist_schema Implementation of hook_schema().
img_assist_uninstall Implementation of hook_uninstall().
img_assist_update_6200 Remove obsolete img_assist_preview_count variable. Disable Image assist if Views is not installed/enabled.