You are here

function feeds_oauth_requirements in Feeds OAuth 7

Implements hook_requirements().

File

./feeds_oauth.install, line 10
Install schema and updates.

Code

function feeds_oauth_requirements($phase) {
  $requirements = array();
  $t = get_t();
  if ($phase == 'runtime') {

    // php-proauth library.
    $path = rtrim(variable_get('feeds_oauth_library_path', FEEDS_OAUTH_LIBRARY_PATH_DEFAULT), '/');
    $satisfied = is_file($path . '/lib/oauth/OAuthClient.php');
    $requirements['php-proauth'] = array(
      'title' => 'php-proauth library',
      'value' => $satisfied ? $t('php-proauth found at %path.', array(
        '%path' => empty($path) ? $t('[empty path]') : $path,
      )) : $t('php-proauth NOT found at %path. If you haven\'t done so already, please <a href="@url">download it</a>. You can also <a href="@setting">modify the library path setting</a>.', array(
        '%path' => $path,
        '@url' => 'https://code.google.com/p/php-proauth/',
        '@setting' => url('admin/config/services/feeds-oauth'),
      )),
      'severity' => $satisfied ? REQUIREMENT_OK : REQUIREMENT_ERROR,
    );

    // php-curl library.
    $satisfied = function_exists('curl_init');
    $requirements['php-curl'] = array(
      'title' => 'cURL',
      'value' => $satisfied ? $t('Enabled') : $t('Missing'),
      'severity' => $satisfied ? REQUIREMENT_OK : REQUIREMENT_ERROR,
    );
  }
  return $requirements;
}