function drupal_check_module

Same name in other branches
  1. 9 core/includes/install.inc \drupal_check_module()
  2. 8.9.x core/includes/install.inc \drupal_check_module()
  3. 10 core/includes/install.inc \drupal_check_module()
  4. 11.x core/includes/install.inc \drupal_check_module()

Checks a module's requirements.

Parameters

$module: Machine name of module to check.

Return value

TRUE or FALSE, depending on whether the requirements are met.

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

File

includes/install.inc, line 1230

Code

function drupal_check_module($module) {
    module_load_install($module);
    if (module_hook($module, 'requirements')) {
        // 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) {
                    $message = $requirement['description'];
                    if (isset($requirement['value']) && $requirement['value']) {
                        $message .= ' (' . t('Currently using !item !version', array(
                            '!item' => $requirement['title'],
                            '!version' => $requirement['value'],
                        )) . ')';
                    }
                    drupal_set_message($message, 'error');
                }
            }
            return FALSE;
        }
    }
    return TRUE;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.