function _prod_check_missing_module_files in Production check & Production monitor 7
Same name and namespace in other branches
- 6 prod_check.module \_prod_check_missing_module_files()
File
- ./
prod_check.module, line 1715
Code
function _prod_check_missing_module_files($caller = 'internal') {
$missing = $total = 0;
$check = $modules = array();
$title = 'Active modules';
// Get a list of .module files for active modules. If a module is active but
// the .module file is missing, this can cause serious performance issues, see
// http://drupal.org/node/1080330.
$result = db_query("SELECT filename FROM {system} WHERE status = 1 AND filename NOT LIKE '%.info'");
foreach ($result as $row) {
$path = DRUPAL_ROOT . '/' . $row->filename;
if (!file_exists($path)) {
$modules[] = $row->filename;
$missing++;
}
$total++;
}
$check['prod_check_modules_available'] = array(
'#title' => t($title),
'#state' => $missing == 0,
'#severity' => $caller == 'nagios' ? NAGIOS_STATUS_CRITICAL : PROD_CHECK_REQUIREMENT_ERROR,
'#value_ok' => t('A total of !total active modules are registered in the database. No missing entries found.', array(
'!total' => $total,
)),
'#value_nok' => t('A total of !total active modules are registered in the database. !missing missing entries found!', array(
'!total' => $total,
'!missing' => $missing,
)),
'#description_ok' => t('All *.module files are present.'),
'#description_nok' => t('The following files are missing: %modules.', array(
'%modules' => implode(', ', $modules),
)),
'#nagios_key' => 'MODS',
'#nagios_type' => 'state',
);
return prod_check_execute_check($check, $caller);
}