You are here

warden.install in Warden 7

Same filename and directory in other branches
  1. 8.2 warden.install
  2. 8 warden.install
  3. 6 warden.install
  4. 3.x warden.install

Clean up file for warden

File

warden.install
View source
<?php

/**
 * @file
 * Clean up file for warden
 */

/**
 * Implements hook_uninstall().
 *
 * Removes all settings used by the module.
 */
function warden_uninstall() {
  variable_del('warden_allow_requests');
  variable_del('warden_public_allow_ips');
  variable_del('warden_match_core');
  variable_del('warden_match_contrib');
  variable_del('warden_match_contrib_mode');
  variable_del('warden_preg_match_contrib');
  variable_del('warden_match_custom');
  variable_del('warden_preg_match_custom');
  variable_del('warden_token');
  variable_del('warden_need_protect_token');
  variable_del('warden_encrypt_token');
}

/**
 * Implements hook_requirements().
 */
function warden_requirements($phase) {
  $requirements = array();
  $t = get_t();
  $ssl_available = function_exists('openssl_seal');
  $requirements['warden_openssl'] = array(
    'title' => $t('Warden'),
    'value' => $ssl_available ? $t('Open SSL is available') : $t('Open SSL is not available'),
    'description' => $t('The PHP OpenSSL extension needs to be installed to communicate with Warden - ') . l(t('PHP Manual'), 'http://php.net/manual/en/openssl.installation.php'),
    'severity' => $ssl_available ? REQUIREMENT_OK : REQUIREMENT_ERROR,
  );
  if ($phase == 'runtime') {
    $warden_available = FALSE;
    $error = '';
    try {
      warden_get_api()
        ->getPublicKey();
      $warden_available = TRUE;
    } catch (Exception $e) {
      $error = $e
        ->getMessage();
      $warden_available = FALSE;
    }
    $requirements['warden_available'] = array(
      'title' => $t('Warden available'),
      'value' => $warden_available ? $t('The Warden server can be contacted') : $t('The Warden server cannot be contacted'),
      'description' => check_plain($error),
      'severity' => $warden_available ? REQUIREMENT_OK : REQUIREMENT_ERROR,
    );
  }
  return $requirements;
}

/**
 * Implementations of hook_update_N().
 */

/**
 * Clear the menu cache so that the 'admin/reports/warden' path can be properly
 * handled.
 */
function warden_update_7100() {
  variable_set('menu_rebuild_needed', TRUE);
}

Functions

Namesort descending Description
warden_requirements Implements hook_requirements().
warden_uninstall Implements hook_uninstall().
warden_update_7100 Clear the menu cache so that the 'admin/reports/warden' path can be properly handled.