You are here

acquia_purge.install in Acquia Purge 6

Same filename and directory in other branches
  1. 7 acquia_purge.install

Installation file for the Acquia Purge module.

File

acquia_purge.install
View source
<?php

/**
 * @file
 * Installation file for the Acquia Purge module.
 */

/**
 * Implements hook_install().
 */
function acquia_purge_install() {
  drupal_install_schema('acquia_purge');
}

/**
 * Implements hook_uninstall().
 */
function acquia_purge_uninstall() {
  drupal_uninstall_schema('acquia_purge');
  variable_del('acquia_purge_queue_counter');
  variable_del('acquia_purge_queue_owners');
}

/**
 * Implements hook_requirements().
 */
function acquia_purge_requirements($phase) {
  if ($phase == 'runtime') {
    $requirements = _acquia_purge_get_diagnosis();

    // Remove ACQUIA_PURGE_SEVLEVEL_OK results, they'll be too noisy.
    foreach ($requirements as $name => $result) {
      if ($result['severity'] === ACQUIA_PURGE_SEVLEVEL_OK) {
        unset($requirements[$name]);
      }
    }

    // Remove the status test once ERROR level results have been detected.
    if (count(_acquia_purge_get_diagnosis(ACQUIA_PURGE_SEVLEVEL_ERROR))) {
      unset($requirements['acquia_purge_status']);
    }
    return $requirements;
  }
  return array();
}

/**
 * Implements hook_schema().
 */
function acquia_purge_schema() {
  $schema = array();
  $schema['ap_queue'] = array(
    'description' => 'Stores paths to be purged in a queue table.',
    'fields' => array(
      'item_id' => array(
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'description' => 'Primary Key: Unique item ID.',
      ),
      'path' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
        'description' => 'The path to be purged.',
      ),
    ),
    'primary key' => array(
      'item_id',
    ),
  );
  return $schema;
}