function _prod_check_page_compression in Production check & Production monitor 7
Same name and namespace in other branches
- 6 prod_check.module \_prod_check_page_compression()
File
- ./
prod_check.module, line 1042
Code
function _prod_check_page_compression($caller = 'internal') {
$check = array();
$status = TRUE;
$title = 'Compress cached pages.';
$path = 'admin/config/development/performance';
if ($caller != 'internal') {
$path = PRODCHECK_BASEURL . $path;
}
// Adjust path if Boost is enabled.
if (variable_get('boost_enabled', 0) == 1) {
$path .= '/boost';
}
if (variable_get('page_compression', 0) == 0) {
$status = FALSE;
// When using Varnish, turning off page compression is a good thing!
if (module_exists('varnish') || module_exists('steroids')) {
$status = TRUE;
}
// Check if server is already handling compression, in which case the
// setting also should be off.
if (function_exists('ob_gzhandler') && ini_get('zlib.output_compression')) {
$status = TRUE;
}
}
$check['prod_check_page_compression'] = array(
'#title' => t($title),
'#state' => $status,
'#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. You should enable page compression on production sites!', prod_check_link_array($title, $path)),
'#nagios_key' => 'PCOMP',
'#nagios_type' => 'state',
);
return prod_check_execute_check($check, $caller);
}