You are here

panels_mini.install in Panels 6.2

File

panels_mini/panels_mini.install
View source
<?php

/**
 * Implementation of hook_schema().
 */
function panels_mini_schema() {

  // This should always point to our 'current' schema. This makes it relatively easy
  // to keep a record of schema as we make changes to it.
  return panels_mini_schema_1();
}

/**
 * Schema version 1 for Panels in D6.
 */
function panels_mini_schema_1() {
  $schema = array();
  $schema['panels_mini'] = array(
    'fields' => array(
      'pid' => array(
        'type' => 'serial',
        'not null' => TRUE,
      ),
      'name' => array(
        'type' => 'varchar',
        'length' => '255',
      ),
      'category' => array(
        'type' => 'varchar',
        'length' => '64',
      ),
      'did' => array(
        'type' => 'int',
      ),
      'title' => array(
        'type' => 'varchar',
        'length' => '128',
      ),
      'requiredcontexts' => array(
        'type' => 'text',
        'size' => 'big',
      ),
      'contexts' => array(
        'type' => 'text',
        'size' => 'big',
      ),
      'relationships' => array(
        'type' => 'text',
        'size' => 'big',
      ),
    ),
    'primary key' => array(
      'pid',
    ),
    'unique keys' => array(
      'name' => array(
        'name',
      ),
    ),
  );
  return $schema;
}

/**
 * Implementation of hook_install().
 */
function panels_mini_install() {
  drupal_install_schema('panels_mini');
}

/**
 * Implementation of hook_uninstall().
 */
function panels_mini_uninstall() {
  $result = db_query("SELECT * FROM {panels_mini} ORDER BY title");
  $panels_exists = db_table_exists('panels_display');
  while ($panel_mini = db_fetch_object($result)) {

    // Delete all associated displays.
    if (!function_exists('panels_delete_display')) {
      require_once drupal_get_path('module', 'panels') . '/panels.module';
    }
    if ($panels_exists) {
      panels_delete_display($panel_mini->did);
    }

    // Delete all configured blocks.
    db_query("DELETE FROM {blocks} WHERE module = 'panels_mini' AND delta = %d", $panel_mini->pid);
  }

  // Finally, delete all mini panels.
  drupal_uninstall_schema('panels_mini');
}

Functions

Namesort descending Description
panels_mini_install Implementation of hook_install().
panels_mini_schema Implementation of hook_schema().
panels_mini_schema_1 Schema version 1 for Panels in D6.
panels_mini_uninstall Implementation of hook_uninstall().