You are here

function _prod_check_site_mail in Production check & Production monitor 7

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

File

./prod_check.module, line 745

Code

function _prod_check_site_mail($caller = 'internal') {
  $check = array();
  $title = 'Site e-mail';
  $path = 'admin/config/system/site-information';
  if ($caller != 'internal') {
    $path = PRODCHECK_BASEURL . $path;
  }
  $site_mail = variable_get('site_mail', '');
  $arguments = array(
    '%mail' => $site_mail,
  );
  $check['prod_check_site_mail'] = array(
    '#title' => t($title),
    '#state' => $site_mail != '' && !preg_match('/' . preg_quote(variable_get('prod_check_sitemail', '')) . '/i', $site_mail),
    '#severity' => $caller == 'nagios' ? NAGIOS_STATUS_CRITICAL : PROD_CHECK_REQUIREMENT_ERROR,
    '#value_ok' => t('Global site e-mail address OK: %mail', $arguments),
    '#value_nok' => t('Global site e-mail address set to %mail', $arguments),
    '#description_ok' => prod_check_ok_title($title, $path),
    '#description_nok' => t('The !link address of the website should not be a development address on production sites!', prod_check_link_array($title, $path)),
    '#nagios_key' => 'MAIL',
    '#nagios_type' => 'state',
  );
  return prod_check_execute_check($check, $caller);
}