You are here

function saml_sp_requirements in SAML Service Provider 7.8

Same name and namespace in other branches
  1. 7.2 saml_sp.module \saml_sp_requirements()
  2. 7.3 saml_sp.module \saml_sp_requirements()

Implements hook_requirements().

File

./saml_sp.module, line 293
SAML Service Provider

Code

function saml_sp_requirements($phase) {

  /*
    $requirements = array();

    if ($phase == 'runtime') {
      $t = 't';

      // php-saml library
      $library = libraries_detect('php-saml');
      $error_type = isset($library['error']) ? drupal_ucfirst($library['error']) : '';
      $error_message = isset($library['error message']) ? $library['error message'] : '';

      if (empty($library['installed'])) {
        $requirements['php_saml_library'] = array(
          'title' => $t('PHP SAML library'),
          'value' => $t('@e: At least @a', array('@e' => $error_type, '@a' => PHP_SAML_LIBRARY_MIN_VERSION)),
          'severity' => REQUIREMENT_ERROR,
          'description' => $t('!error You need to download the !library, extract the archive and place the !machine_name directory in the %path directory on your server.', array('!error' => $error_message, '!library' => l($t('PHP SAML library'), $library['download url']), '%path' => 'sites/all/libraries', '!machine_name' => $library['machine name'])),
        );
      }
      elseif (version_compare($library['version'], PHP_SAML_LIBRARY_MIN_VERSION, '>=')) {
        $requirements['php_saml_library'] = array(
          'title' => $t('PHP SAML library'),
          'severity' => REQUIREMENT_OK,
          'value' => $library['version'],
        );
      }
      else {
        $requirements['php_saml_library'] = array(
          'title' => $t('PHP SAML library'),
          'value' => $t('At least @a', array('@a' => PHP_SAML_LIBRARY_MIN_VERSION)),
          'severity' => REQUIREMENT_ERROR,
          'description' => $t('You need to download a later version of the !library and replace the old version located in the %path directory on your server.', array('!library' => l($t('PHP SAML library'), $library['download url']), '%path' => $library['library path'])),
        );
      }


      // xmlseclibs library
      $library = libraries_detect('xmlseclibs');
      $error_type = isset($library['error']) ? drupal_ucfirst($library['error']) : '';
      $error_message = isset($library['error message']) ? $library['error message'] : '';
      $library_name = $t($library['name']);

      if (empty($library['installed'])) {
        $requirements[$library['machine name']] = array(
          'title' => $library_name,
          'value' => $t('@e: At least @a', array('@e' => $error_type, '@a' => XMLSECLIBS_MIN_VERSION)),
          'severity' => REQUIREMENT_ERROR,
          'description' => $t('!error You need to download the !library, extract the archive and place the !machine_name directory in the %path directory on your server.', array('!error' => $error_message, '!library' => l($library_name, $library['download url']), '%path' => 'sites/all/libraries', '!machine_name' => $library['machine name'])),
        );
      }
      elseif (version_compare($library['version'], XMLSECLIBS_MIN_VERSION, '>=')) {
        $requirements[$library['machine name']] = array(
          'title' => $library_name,
          'severity' => REQUIREMENT_OK,
          'value' => $library['version'],
        );
      }
      else {
        $requirements[$library['machine name']] = array(
          'title' => $library_name,
          'value' => $t('At least @a', array('@a' => XMLSECLIBS_MIN_VERSION)),
          'severity' => REQUIREMENT_ERROR,
          'description' => $t('You need to download a later version of the !library and replace the old version located in the %path directory on your server.', array('!library' => l($library_name, $library['download url']), '%path' => $library['library path'])),
        );
      }
    }

    return $requirements;/**/
}