function _prod_check_release_notes in Production check & Production monitor 6
Same name and namespace in other branches
- 7 prod_check.module \_prod_check_release_notes()
File
- ./
prod_check.module, line 872
Code
function _prod_check_release_notes($caller = 'internal') {
$check = array();
$title = 'Release notes';
$files = array(
'CHANGELOG.txt',
'COPYRIGHT.txt',
'INSTALL.mysql.txt',
'INSTALL.pgsql.txt',
'INSTALL.txt',
'LICENSE.txt',
'MAINTAINERS.txt',
'UPGRADE.txt',
);
$remaining_files = array();
$error = FALSE;
foreach ($files as $file) {
// It would seem that $_SERVER['DOCUMENT_ROOT'] is not always set, hence the
// use of realpath() in combination with base path to determine the full
// path to the Drupal installation.
if (file_exists(realpath('.' . base_path()) . '/' . $file)) {
array_push($remaining_files, $file);
$error = TRUE;
}
}
$check['prod_check_release_notes'] = array(
'#title' => t($title),
'#state' => !$error,
'#severity' => $caller == 'nagios' ? NAGIOS_STATUS_WARNING : PROD_CHECK_REQUIREMENT_WARNING,
'#value_ok' => t('Release note .txt files have been removed.'),
'#value_nok' => t('Release note .txt files still present on your server!'),
'#description_ok' => t('Status is OK for production use.'),
'#description_nok' => t('Leaving the "!files" files present on the webserver is a minor security risk. These files are useless on production anyway and they simply should not be there.', array(
'!files' => implode(', ', $remaining_files),
)),
'#nagios_key' => 'REL',
'#nagios_type' => 'state',
);
return prod_check_execute_check($check, $caller);
}