You are here

uc_shipping_zones.install in Ubercart Global Quote 6

Same filename and directory in other branches
  1. 7 uc_shipping_zones/uc_shipping_zones.install

uc_shipping_zones installation file

File

uc_shipping_zones/uc_shipping_zones.install
View source
<?php

/**
 * @file
 * uc_shipping_zones installation file
 */

/**
 * Implementation of hook_schema().
 */
function uc_shipping_zones_schema() {
  $schema['uc_shipping_zones'] = array(
    'description' => '',
    'fields' => array(
      'zid' => array(
        'type' => 'serial',
        'not null' => TRUE,
      ),
      'name' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => FALSE,
      ),
      'countries' => array(
        'type' => 'text',
        'not null' => FALSE,
      ),
      'regions' => array(
        'type' => 'text',
        'not null' => FALSE,
      ),
    ),
    'primary key' => array(
      'zid',
    ),
  );
  return $schema;
}

/**
 * Implementation of hook_install().
 */
function uc_shipping_zones_install() {
  drupal_install_schema('uc_shipping_zones');
}

/**
 * Implementation of hook_uninstall().
 */
function uc_shipping_zones_uninstall() {
  drupal_uninstall_schema('uc_shipping_zones');
}

/**
 * Enables aha helper for primitive versions of the module
 */
function uc_shipping_zones_update_6010(&$sandbox) {

  // For most updates, the following is sufficient.
  $ret = array();

  // try to enable ahah helper
  if (!module_exists('ahah_helper')) {
    drupal_install_modules(array(
      'ahah_helper',
    ));
  }
  if (module_exists('ahah_helper')) {

    // Add region field
    db_add_field($ret, 'uc_shipping_zones', 'regions', array(
      'type' => 'text',
      'not null' => FALSE,
    ));
  }
  else {
    $ret['#abort'] = array(
      'success' => FALSE,
      'query' => 'Please Install ' . l('Aha Helper module', 'http://drupal.org/project/ahah_helper'),
    );
  }
  return $ret;
}

Functions

Namesort descending Description
uc_shipping_zones_install Implementation of hook_install().
uc_shipping_zones_schema Implementation of hook_schema().
uc_shipping_zones_uninstall Implementation of hook_uninstall().
uc_shipping_zones_update_6010 Enables aha helper for primitive versions of the module