You are here

function taxonomy_defaults_requirements in Taxonomy Defaults 6.2

Same name and namespace in other branches
  1. 6 taxonomy_defaults.install \taxonomy_defaults_requirements()
  2. 7 taxonomy_defaults.install \taxonomy_defaults_requirements()

Implementation of hook_requirements().

File

./taxonomy_defaults.install, line 43
Install, update and uninstall functions for the taxonomy_defaults module.

Code

function taxonomy_defaults_requirements($phase) {
  $requirements = array();
  $tax_weight = 0;
  $weight = 0;
  $query = "SELECT weight FROM {system} WHERE type = 'module' AND status = 1 and name = 'taxonomy'";
  $result = db_query($query);
  if ($row = db_fetch_object($result)) {
    $tax_weight = $row->weight;
  }
  $query = "SELECT weight FROM {system} WHERE type = 'module' AND status = 1 and name = 'taxonomy_defaults'";
  $result = db_query($query);
  if ($row = db_fetch_object($result)) {
    $weight = $row->weight;
    if ($tax_weight >= $weight) {
      $requirements['taxdef'] = array(
        'title' => t('Taxonomy Defaults'),
        'value' => t('Invalid Module Weight'),
        'severity' => REQUIREMENT_ERROR,
        'description' => t("The Taxonomy Defaults module's weight is lower than the Taxonomy module's, so taxonomy default settings will be ignored. !link to learn more about module weights, or reinstall the Taxonomy Defaults module.", array(
          '!link' => l('Go here', 'http://drupal.org/node/110238'),
        )),
      );
    }
  }
  return $requirements;
}