You are here

gathercontent.install in GatherContent 7.2

Install, uninstall, and update functions for the GatherContent module.

File

gathercontent.install
View source
<?php

/**
 * @file
 * Install, uninstall, and update functions for the GatherContent module.
 */

/**
 * Implements hook_requirements().
 */
function gathercontent_requirements($phase) {
  $requirements = array();
  $has_curl = function_exists('curl_init');
  $t = get_t();
  $requirements['curl'] = array(
    'title' => $t('cURL'),
    'value' => $has_curl ? $t('Enabled') : $t('Not found'),
  );
  if (!$has_curl) {
    $requirements['curl']['severity'] = REQUIREMENT_ERROR;
    $requirements['curl']['description'] = $t('GatherContent could not be installed because the PHP <a href="@curl_url">cURL</a> library is not available.', array(
      '@curl_url' => 'http://php.net/manual/en/curl.setup.php',
    ));
  }
  return $requirements;
}

/**
 * Implements hook_uninstall().
 */
function gathercontent_uninstall() {
  variable_del('gathercontent_project_id');
  variable_del('gathercontent_api_url');
  variable_del('gathercontent_api_key');
  variable_del('gathercontent_media_files');
  variable_del('gathercontent_selected_pages');
  variable_del('gathercontent_saved_settings');
  variable_del('gathercontent_saved_pages');
}

/**
 * Implements hook_schema().
 */
function gathercontent_schema() {
  $schema['gathercontent_media'] = array(
    'description' => 'Contains media file IDs to prevent multiple downloads',
    'fields' => array(
      'fid' => array(
        'description' => 'Drupal file fid from the file_managed table',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'gid' => array(
        'description' => 'GatherContent file ID',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
    ),
    'unique keys' => array(
      'fid' => array(
        'fid',
      ),
      'gid' => array(
        'gid',
      ),
    ),
  );
  return $schema;
}