You are here

function feeds_requirements in Feeds 8.2

Same name and namespace in other branches
  1. 7.2 feeds.install \feeds_requirements()

Implements hook_requirements().

File

./feeds.install, line 11
Schema definitions install/update/uninstall hooks.

Code

function feeds_requirements($phase) {
  $t = get_t();
  $requirements = array(
    'simplexml' => array(
      'title' => $t('SimpleXML'),
      'value' => extension_loaded('SimpleXML') ? $t('Enabled') : $t('Disabled'),
      'description' => $t('SimpleXML PHP module is required for Feeds Syndication Parser.'),
      'severity' => REQUIREMENT_INFO,
    ),
    'simplepie' => array(
      'title' => $t('SimplePie'),
      'value' => $t('Unknown at install time.'),
      'description' => $t('SimplePie library is required for Feeds SimplePie Parser.'),
      'severity' => REQUIREMENT_INFO,
    ),
  );
  if ($phase == 'runtime') {

    // Check for SimpleXML, required by FeedsSyndicationParser.
    if (extension_loaded('SimpleXML')) {
      $requirements['simplexml']['severity'] = REQUIREMENT_OK;
    }
    else {
      $requirements['simplexml']['severity'] = REQUIREMENT_WARNING;
      $requirements['simplexml']['description'] .= ' ' . t('It has been disabled at compile time, seek instructions from the server mantainers to enable it.');
    }

    // Check for SimplePie, required by FeedsSimplePieParser.
    if (feeds_simplepie_exists()) {
      $requirements['simplepie']['value'] = t('Enabled');
      $requirements['simplepie']['severity'] = REQUIREMENT_OK;
    }
    else {
      $requirements['simplepie']['value'] = t('Not installed');
      $requirements['simplepie']['severity'] = REQUIREMENT_WARNING;
      $requirements['simplepie']['description'] .= ' ' . t('Download the compiled version of the library from <a href="@simplepie-download-url">SimplePie download page</a>.', array(
        '@simplepie-download-url' => 'http://simplepie.org/downloads/',
      ));
    }
  }
  return $requirements;
}