You are here

function gauth_requirements in Google Auth 7

Same name and namespace in other branches
  1. 8 gauth.install \gauth_requirements()
  2. 7.2 gauth.install \gauth_requirements()

Implements hook_requirements().

File

./gauth.install, line 105
Install and uninstall functions for the Google OAuth module.

Code

function gauth_requirements($phase) {
  $requirements = array();
  if ($phase == 'runtime') {
    $t = get_t();
    $requirements['gauth'] = array(
      'title' => $t('Google OAuth2'),
      'value' => '',
      'description' => '',
      'severity' => REQUIREMENT_OK,
    );
    $info = libraries_detect('google-api-php-client');
    if (!$info['installed']) {
      $url = l($t('here'), $info['download url']);
      $documentation = l($t('google api php client installation'), 'https://github.com/google/google-api-php-client#installation');
      $version = isset($info['versions']) && !empty($info['versions']) ? array_keys($info['versions']) : array(
        '2.0.0',
      );
      $requirements['gauth']['description'] = $t('Install version "@version" or latest version of the Google api php client library code (from !here) in a libraries directory such as "sites/all/libraries/google-api-php-client". You can also use composer to install, read more at !documentation.  The path should be "sites/all/libraries/google-api-php-client"', array(
        '@version' => $version[0],
        '!here' => $url,
        '!documentation' => $documentation,
      ));
      $requirements['gauth']['severity'] = REQUIREMENT_ERROR;
    }
    else {
      $requirements['gauth']['value'] = $t($info['version']);
    }
  }
  return $requirements;
}