You are here

function _prod_check_webform in Production check & Production monitor 6

Same name and namespace in other branches
  1. 7 prod_check.module \_prod_check_webform()

File

./prod_check.module, line 1568

Code

function _prod_check_webform($caller = 'internal') {
  if (!module_exists('webform')) {
    return;
  }
  $check = array();
  $title = 'Webform';
  $path = 'admin/settings/webform';
  if ($caller != 'internal') {
    $path = PRODCHECK_BASEURL . $path;
  }
  $webform_mail = variable_get('webform_default_from_address', variable_get('site_mail', ini_get('sendmail_from')));
  $arguments = array(
    '!webform' => $title,
    '%mail' => $webform_mail,
  );
  $check['prod_check_webform'] = array(
    '#title' => t($title),
    '#state' => $webform_mail != '' && !preg_match('/' . preg_quote(variable_get('prod_check_sitemail', '')) . '/i', $webform_mail),
    '#severity' => $caller == 'nagios' ? NAGIOS_STATUS_CRITICAL : PROD_CHECK_REQUIREMENT_ERROR,
    '#value_ok' => t('!webform default from e-mail address OK: %mail', $arguments),
    '#value_nok' => t('!webform default from e-mail address set to %mail', $arguments),
    '#description_ok' => prod_check_ok_title($title, $path),
    '#description_nok' => t('The !link default from e-mail address should not be a development address on production sites!', prod_check_link_array($title, $path)),
    '#nagios_key' => 'WFRM',
    '#nagios_type' => 'state',
  );
  return prod_check_execute_check($check, $caller);
}