You are here

function drupal_check_module in Drupal 5

Same name and namespace in other branches
  1. 8 core/includes/install.inc \drupal_check_module()
  2. 6 includes/install.inc \drupal_check_module()
  3. 7 includes/install.inc \drupal_check_module()
  4. 9 core/includes/install.inc \drupal_check_module()

Check a module's requirements.

1 call to drupal_check_module()
system_modules_submit in modules/system/system.module
Submit callback; handles modules form submission.

File

includes/install.inc, line 724

Code

function drupal_check_module($module) {

  // Include install file
  $install = drupal_get_install_files(array(
    $module,
  ));
  if (isset($install[$module])) {
    require_once $install[$module]->filename;

    // Check requirements
    $requirements = module_invoke($module, 'requirements', 'install');
    if (is_array($requirements) && drupal_requirements_severity($requirements) == REQUIREMENT_ERROR) {

      // Print any error messages
      foreach ($requirements as $requirement) {
        if (isset($requirement['severity']) && $requirement['severity'] == REQUIREMENT_ERROR) {
          drupal_set_message($requirement['description'] . ' (' . t('Currently using !item !version', array(
            '!item' => $requirement['title'],
            '!version' => $requirement['value'],
          )) . ')', 'error');
        }
      }
      return FALSE;
    }
  }
  return TRUE;
}