You are here

function querypath_requirements in QueryPath 6

Same name and namespace in other branches
  1. 7.3 querypath.install \querypath_requirements()
  2. 7.2 querypath.install \querypath_requirements()

Implementation of hook_requirements(). Checks to see if the QueryPath library has been installed.

File

./querypath.install, line 12
The installer file for querypath.

Code

function querypath_requirements($phase) {
  $requirements = array();
  switch ($phase) {
    case 'install':
    case 'runtime':
      @(include_once 'QueryPath/QueryPath.php');
      if (function_exists('qp')) {
        $requirements['querypath_lib'] = array(
          'title' => t('QueryPath library'),
          'severity' => REQUIREMENT_OK,
          'value' => 'Present',
        );
      }
      else {
        $params = array(
          '!path' => drupal_get_path('module', 'querypath') . '/QueryPath',
          '!link' => l('http://querypath.org', 'http://querypath.org', array(
            'html' => TRUE,
          )),
        );
        $requirements['querypath_lib'] = array(
          'title' => t('QueryPath library'),
          'severity' => REQUIREMENT_ERROR,
          'description' => t("You must install the QueryPath library from !link. Copy the library's QueryPath folder (querypath-x.x/src/QueryPath) to the QueryPath module directory (!path)", $params),
          'value' => 'Not present',
        );
      }
  }
  return $requirements;
}