You are here

function hybridauth_requirements in HybridAuth Social Login 6.2

Same name and namespace in other branches
  1. 7.2 hybridauth.install \hybridauth_requirements()
  2. 7 hybridauth.install \hybridauth_requirements()

Implements hook_requirements().

File

./hybridauth.install, line 60
Install, update and uninstall functions for the HybridAuth module.

Code

function hybridauth_requirements($phase) {
  $requirements = array();

  // Ensure translations don't break at install time
  $t = get_t();
  if ($phase == 'runtime') {
    if ($lib_path = _hybridauth_library_path()) {
      try {
        require_once $lib_path . '/Hybrid/Auth.php';
        $requirements['hybridauth'] = array(
          'title' => $t('HybridAuth library'),
          'value' => Hybrid_Auth::$version,
          'severity' => REQUIREMENT_OK,
        );
      } catch (Exception $e) {
        $requirements['hybridauth'] = array(
          'title' => $t('HybridAuth library'),
          'value' => $e
            ->getMessage(),
          'severity' => REQUIREMENT_ERROR,
        );
      }
    }
    else {
      $requirements['hybridauth'] = array(
        'title' => $t('HybridAuth library'),
        'value' => $t('HybridAuth library is missing'),
        'severity' => REQUIREMENT_ERROR,
      );
    }
  }
  return $requirements;
}