You are here

crypt_blowfish.install in Web Service Clients 6

Same filename and directory in other branches
  1. 7 backends/clients_drupal/crypt_blowfish/crypt_blowfish.install

Checks blowfish configuration - directory and password are set

@author Django Beatty - adub

File

backends/clients_drupal/crypt_blowfish/crypt_blowfish.install
View source
<?php

/**
 * @file
 * Checks blowfish configuration - directory and password are set
 * 
 * @author Django Beatty - adub
 */

/**
 * Implementation of hook_install().
 */
function crypt_blowfish_install() {
}

/**
 * Implementation of hook_uninstall().
 */
function crypt_blowfish_uninstall() {

  // clean up any variables created by module
  $module_variables = array(
    'crypt_blowfish_cryptdir',
  );
  foreach ($module_variables as $module_variable) {
    variable_del($module_variable);
  }
}

/**
 * Implementation of hook_requirements
 */
function crypt_blowfish_requirements($phase) {
  $requirements = array();
  switch ($phase) {
    case 'install':
      break;
    case 'runtime':
      if (!variable_get('crypt_blowfish_cryptdir', FALSE)) {
        $requirements['crypt_blowfish_cryptdir'] = array(
          'title' => t('Blowfish'),
          'value' => t('Path to PEAR Blowfish library not set'),
          'severity' => REQUIREMENT_ERROR,
        );
      }
      else {
        $requirements['crypt_blowfish_cryptdir'] = array(
          'title' => t('Blowfish'),
          'value' => t('Path set to PEAR Blowfish library (%cryptdir)', array(
            '%cryptdir' => variable_get('crypt_blowfish_cryptdir', ''),
          )),
          'severity' => REQUIREMENT_OK,
        );

        // @todo fix error if not found
        if (Drupal_Crypt_Blowfish::getkey() == 'replace this with a strong password') {
          $requirements['crypt_blowfish_key'] = array(
            'title' => t('Blowfish'),
            'value' => t('Blowfish encryption key has not been set. Please edit the file crypt_blowfish_key.inc in %installdir', array(
              '%installdir' => drupal_get_path('module', 'crypt_blowfish'),
            )),
            'severity' => REQUIREMENT_ERROR,
          );
        }
        else {
          $requirements['crypt_blowfish_key'] = array(
            'title' => t('Blowfish'),
            'value' => t('Blowfish encryption key has been set'),
            'severity' => REQUIREMENT_OK,
          );
        }
      }
      break;
  }
  return $requirements;
}

Functions

Namesort descending Description
crypt_blowfish_install Implementation of hook_install().
crypt_blowfish_requirements Implementation of hook_requirements
crypt_blowfish_uninstall Implementation of hook_uninstall().