You are here

function oauth_common_requirements in OAuth 1.0 6.3

Same name and namespace in other branches
  1. 7.4 oauth_common.install \oauth_common_requirements()
  2. 7.3 oauth_common.install \oauth_common_requirements()

Implements hook_requirements().

File

./oauth_common.install, line 361
Installation and schema related functions for the OAuth module

Code

function oauth_common_requirements($phase) {
  $requirements = array();
  $t = get_t();

  // Check the version of Autoload module.
  include_once drupal_get_path('module', 'autoload') . '/autoload.module';
  if (!function_exists('autoload_registry_rebuild')) {
    $requirements['autoload_version'] = array(
      'title' => $t('OAuth'),
      'description' => $t('Your version of Autoload.module appears to be out of date. OAuth requires at least version 2.x.'),
      'severity' => REQUIREMENT_ERROR,
    );
  }

  // Check that PHP's cURL library is installed.
  $curl_available = function_exists('curl_init');
  $requirements['oauth_common_curl'] = array(
    'title' => $t('OAuth'),
    'value' => $curl_available ? $t('cURL library Enabled') : $t('cURL library not found'),
  );
  if (!$curl_available) {
    $requirements['oauth_common_curl'] += array(
      'severity' => REQUIREMENT_ERROR,
      'description' => $t("DrupalOAuthClient requires the PHP <a href='!curl_url'>cURL</a> library.", array(
        '!curl_url' => 'http://php.net/manual/en/curl.setup.php',
      )),
    );
  }
  return $requirements;
}