You are here

function _prod_check_preprocess_js in Production check & Production monitor 7

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

File

./prod_check.module, line 1261

Code

function _prod_check_preprocess_js($caller = 'internal') {
  $check = array();
  $state = TRUE;
  $title = 'Aggregate JavaScript files.';
  $path = 'admin/config/development/performance';

  // Check settings.
  if (variable_get('preprocess_js', 0) == 0) {
    $state = FALSE;

    // TODO: In D6 there was an extra check on the 'advagg' module. Keep an eye out for a D7 port or a D7 alternative!
  }
  if ($caller != 'internal') {
    $path = PRODCHECK_BASEURL . $path;
  }
  $check['prod_check_preprocess_js'] = array(
    '#title' => t($title),
    '#state' => $state,
    '#severity' => $caller == 'nagios' ? NAGIOS_STATUS_WARNING : PROD_CHECK_REQUIREMENT_WARNING,
    '#value_ok' => t('Enabled'),
    '#value_nok' => t('Disabled'),
    '#description_ok' => prod_check_ok_title($title, $path),
    '#description_nok' => t('Your !link settings are disabled, ideally they should be enabled on a producion environment but this requires testing first, since it can cause JavaScript errors in certain cases.', prod_check_link_array($title, $path)),
    '#nagios_key' => 'JCOMP',
    '#nagios_type' => 'state',
  );
  return prod_check_execute_check($check, $caller);
}