You are here

function _prod_check_release_notes in Production check & Production monitor 7

Same name and namespace in other branches
  1. 6 prod_check.module \_prod_check_release_notes()

File

./prod_check.module, line 952

Code

function _prod_check_release_notes($caller = 'internal') {
  $check = array();
  $title = 'Release notes & help files';
  $files = array(
    'CHANGELOG.txt',
    'COPYRIGHT.txt',
    'INSTALL.mysql.txt',
    'INSTALL.pgsql.txt',
    'INSTALL.sqlite.txt',
    'INSTALL.txt',
    'LICENSE.txt',
    'MAINTAINERS.txt',
    'README.txt',
    'UPGRADE.txt',
    'sites/all/README.txt',
    'sites/all/themes/README.txt',
    'sites/all/modules/README.txt',
  );
  $remaining_files = array();
  $error = FALSE;
  foreach ($files as $file) {
    if (file_exists(DRUPAL_ROOT . '/' . $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 & help files have been removed.'),
    '#value_nok' => t('Release note & help 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);
}