You are here

function _prod_check_preprocess_css in Production check & Production monitor 6

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

File

./prod_check.module, line 1142

Code

function _prod_check_preprocess_css($caller = 'internal') {
  $check = array();
  $state = TRUE;
  $title = 'Optimize CSS files';
  $path = 'admin/settings/performance';

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

    // Check if Advanced CSS/JS Aggregation is being used
    if (module_exists('advagg') && module_exists('advagg_css_compress')) {
      $title = 'Advanced CSS Aggregation';
      $path = 'admin/settings/advagg/css-compress';
      if (variable_get('advagg_enabled', TRUE) && variable_get('advagg_css_compress_agg_files', TRUE)) {
        $state = TRUE;
      }
    }
  }
  if ($caller != 'internal') {
    $path = PRODCHECK_BASEURL . $path;
  }
  $check['prod_check_preprocess_css'] = array(
    '#title' => t($title),
    '#state' => $state,
    '#severity' => $caller == 'nagios' ? NAGIOS_STATUS_CRITICAL : PROD_CHECK_REQUIREMENT_ERROR,
    '#value_ok' => t('Enabled'),
    '#value_nok' => t('Disabled'),
    '#description_ok' => prod_check_ok_title($title, $path),
    '#description_nok' => t('Your !link settings are disabled, they should be enabled on a producion environment! This should not cause trouble if you steer clear of @import statements.', prod_check_link_array($title, $path)),
    '#nagios_key' => 'CCOMP',
    '#nagios_type' => 'state',
  );
  return prod_check_execute_check($check, $caller);
}