Skip to content
fiftyone_degrees.install 997 B
Newer Older
unknown's avatar
unknown committed
<?php
unknown's avatar
unknown committed

unknown's avatar
unknown committed
/**
 * @file
unknown's avatar
unknown committed
 * Provides install, upgrade and un-install functions for fiftyone_degrees.
unknown's avatar
unknown committed
 */
unknown's avatar
unknown committed

unknown's avatar
unknown committed
/**
unknown's avatar
unknown committed
 * Implements hook requirements.
unknown's avatar
unknown committed
 */
function fiftyone_degrees_requirements($phase) {
  $requirements = array();

unknown's avatar
unknown committed
  if ($phase == 'runtime') {
unknown's avatar
unknown committed
    $library = libraries_detect('51Degrees');
unknown's avatar
unknown committed
    // If the library is not installed then throw an error.
    if (!$library['installed']) {
unknown's avatar
unknown committed
      $requirements[] = array(
        'title' => '51Degrees',
unknown's avatar
unknown committed
        'value' => '1.0',
        'description' => 'You need to download the <a href="' . $library['download url'] . '" >51Degrees library</a>, extract the archive and place the library in the sites/all/libraries directory on your server.',
unknown's avatar
unknown committed
        'severity' => REQUIREMENT_ERROR,
      );
    }
  }
  return $requirements;
}

/**
 * Implements hook_uninstall().
 */
function fiftyone_degrees_uninstall() {
  variable_del('fiftyone_degrees_rules');
  variable_del('fiftyone_degrees_settings');
  variable_del('fiftyone_degrees_licence_key');