You are here

function biblio_requirements in Bibliography Module 6.2

Same name and namespace in other branches
  1. 7.2 biblio.install \biblio_requirements()

Implements hook_requirements().

File

./biblio.install, line 183
Install, update, and uninstall functions for the biblio module.

Code

function biblio_requirements($phase) {
  $requirements = array();
  $message = '';

  // Ensure translations do not break at install time.
  $t = get_t();

  // @todo: When is this requirement check called?
  if ($phase == 'runtime') {
    $dir = drupal_get_path('module', 'biblio');
    $files = file_scan_directory($dir, '..*.inc$', array(
      '.',
      '..',
    ), 0, FALSE);
    if (count($files)) {
      $message = $t('There is a problem with your Biblio installation! There should not be any ".inc" files in the %biblio directory.  You probably forgot to delete the old biblio files when you upgraded the module.  You should remove the following files from that directory...', array(
        '%biblio' => $dir,
      ));
      $message .= "<ul>";
      foreach ($files as $file) {
        $message .= "<li>" . $file->basename;
      }
      $message .= "</ul>";
    }
    $requirements['biblio'] = array(
      'title' => $t('Biblio'),
      'value' => BIBLIO_VERSION,
      'severity' => empty($message) ? REQUIREMENT_OK : REQUIREMENT_ERROR,
      'description' => $message,
    );
  }
  return $requirements;
}