You are here

function oauth_requirements in OAuth 1.0 8.2

Same name and namespace in other branches
  1. 8 oauth.install \oauth_requirements()

Implements hook_requirements().

File

./oauth.install, line 13
Installation and schema related functions for the OAuth module.

Code

function oauth_requirements($phase) {
  $requirements = array();
  $oauth_available = class_exists('\\OauthProvider');
  if ($oauth_available) {
    $requirements['oauth_pecl'] = array(
      'title' => t('OAuth'),
      'value' => t('OAuth PECL library installed'),
    );
  }
  else {
    $requirements['oauth_pecl'] = array(
      'title' => t('OAuth'),
      'severity' => REQUIREMENT_ERROR,
      'description' => t("OAuth module requires the <a href='@oauth_url' target='_blank'>PECL OAuth</a> library.", array(
        '@oauth_url' => 'http://www.php.net/manual/en/book.oauth.php',
      )),
    );
    if ($phase == 'runtime') {
      $requirements['oauth_pecl'] += array(
        'value' => t('OAuth PECL library not installed'),
      );
    }
  }
  return $requirements;
}