You are here

function encrypt_requirements in Encrypt 7.3

Same name and namespace in other branches
  1. 6 encrypt.install \encrypt_requirements()
  2. 7 encrypt.install \encrypt_requirements()
  3. 7.2 encrypt.install \encrypt_requirements()

Implements hook_requirements().

File

./encrypt.install, line 135
Install, update and uninstall functions for the encrypt module.

Code

function encrypt_requirements($phase) {
  $t = get_t();
  $requirements = array();
  switch ($phase) {
    case 'runtime':
      $method = encrypt_get_encryption_method();
      $key_provider = encrypt_get_key_provider();

      // Check the plugins for dependency errors.
      if (isset($method['dependency errors']) && !empty($method['dependency errors'])) {
        $dependency_errors .= theme('item_list', array(
          'items' => $method['dependency errors'],
        ));
      }
      if (isset($key_provider['dependency errors']) && !empty($key_provider['dependency errors'])) {
        $dependency_errors .= theme('item_list', array(
          'items' => $key_provider['dependency errors'],
        ));
      }
      if (isset($dependency_errors) && !empty($dependency_errors)) {
        $requirements['encrypt_dependencies'] = array(
          'title' => $t('Encrypt Dependencies'),
          'value' => $t('Unmet dependencies'),
          'description' => $t('There are unmet dependencies in your active encryption plugins. Either !change_link or resolve the following dependencies: !deps', array(
            '!change_link' => l($t('change your encryption settings'), 'admin/config/system/encrypt'),
            '!deps' => $dependency_errors,
          )),
          'severity' => REQUIREMENT_ERROR,
        );
      }

      // Set a warning about the Drupal Private Key method.
      if ($key_provider['name'] == 'drupal_private_key') {
        $requirements['encrypt_secure'] = array(
          'title' => $t('Encryption Security'),
          'description' => $t('The site is using the private key stored in the database to encrypt
            data. While this provides some level of obfuscation, it is highly
            recommended to store the encryption key outside of the database.
            See the !link for more information.', array(
            '!link' => l($t('Encrypt module page'), 'http://drupal.org/project/encrypt'),
          )),
          'severity' => REQUIREMENT_WARNING,
          'value' => $t('Security concerns'),
        );
      }
      break;
  }
  return $requirements;
}