You are here

function openid_requirements in Drupal 7

Implements hook_requirements().

File

modules/openid/openid.install, line 93
Install, update and uninstall functions for the openid module.

Code

function openid_requirements($phase) {
  $requirements = array();
  if ($phase == 'runtime') {

    // Check for the PHP BC Math library.
    if (!function_exists('bcadd') && !function_exists('gmp_add')) {
      $requirements['openid_math'] = array(
        'value' => t('Not installed'),
        'severity' => REQUIREMENT_ERROR,
        'description' => t('OpenID suggests the use of either the <a href="@gmp">GMP Math</a> (recommended for performance) or <a href="@bc">BC Math</a> libraries to enable OpenID associations.', array(
          '@gmp' => 'http://php.net/manual/en/book.gmp.php',
          '@bc' => 'http://www.php.net/manual/en/book.bc.php',
        )),
      );
    }
    elseif (!function_exists('gmp_add')) {
      $requirements['openid_math'] = array(
        'value' => t('Not optimized'),
        'severity' => REQUIREMENT_WARNING,
        'description' => t('OpenID suggests the use of the GMP Math library for PHP for optimal performance. Check the <a href="@url">GMP Math Library documentation</a> for installation instructions.', array(
          '@url' => 'http://www.php.net/manual/en/book.gmp.php',
        )),
      );
    }
    else {
      $requirements['openid_math'] = array(
        'value' => t('Installed'),
        'severity' => REQUIREMENT_OK,
      );
    }
    $requirements['openid_math']['title'] = t('OpenID Math library');
  }
  return $requirements;
}