You are here

function _prod_check_xmlsitemap in Production check & Production monitor 7

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

File

./prod_check.module, line 1980

Code

function _prod_check_xmlsitemap($caller = 'internal') {
  $check = array();
  $error = FALSE;
  $xml_base_url = variable_get('xmlsitemap_base_url', $GLOBALS['base_url']);
  $value_nok = $msg_nok = '';
  $title_ok = 'settings';
  $text_ok = 'Check the !link to verify if they are as you expect.';
  $title = 'XML sitemap';
  $path = 'admin/config/search/xmlsitemap/settings';
  if ($caller != 'internal') {
    $path = PRODCHECK_BASEURL . $path;
  }
  if (!module_exists('xmlsitemap')) {
    $error = TRUE;
    $value_nok = t('Disabled');
    $msg_nok = t('You have not enabled the !link module. This module generates an XML sitemap which can be submitted to search engines, guaranteeing optimal indexation of all urls within the site.', prod_check_link_array($title, 'http://drupal.org/project/xmlsitemap'));
  }
  elseif (strtolower($xml_base_url) != strtolower($GLOBALS['base_url'])) {
    $error = TRUE;
    $value_nok = t('Not properly configured.');
    $msg_nok = t('Your sitemap.xml !link is not the same as the current base URL you are viewing the site from.', prod_check_link_array('default base URL', $path));
  }
  $check['prod_check_xmlsitemap'] = array(
    '#title' => t($title),
    '#state' => !$error,
    '#severity' => $caller == 'nagios' ? NAGIOS_STATUS_WARNING : PROD_CHECK_REQUIREMENT_WARNING,
    '#value_ok' => t('Enabled'),
    '#value_nok' => $value_nok,
    '#description_ok' => prod_check_ok_title($title_ok, $path, $text_ok),
    '#description_nok' => $msg_nok,
    '#nagios_key' => 'XMLS',
    '#nagios_type' => 'state',
  );
  return prod_check_execute_check($check, $caller);
}