Commit 29f8423b authored by Philip_Clarke's avatar Philip_Clarke

Code clean up for #1416214

parent eacffe26
......@@ -203,16 +203,18 @@ function boost_admin_htaccess_generate_htaccess() {
$normal_count = 0;
foreach ($enabled_file_extensions as $extension => $values) {
$type = $values['content_type'];
if ($values['gzip']) {
$output['gzip'] .= " RewriteCond $document_root$base_path$cache_dir/%{ENV:boostpath}/$server_name%{REQUEST_URI}$char%{QUERY_STRING}\.$extension\.gz -s\n";
$output['gzip'] .= " RewriteRule .* $cache_dir/%{ENV:boostpath}/$server_name%{REQUEST_URI}$char%{QUERY_STRING}\.$extension\.gz [L,T=$type,E=no-gzip:1]\n";
$gzip_count++;
}
// #1416214 - https://drupal.org/node/1416214#comment-7225650
// if ($values['gzip']) {
// $output['gzip'] .= " RewriteCond $document_root$base_path$cache_dir/%{ENV:boostpath}/$server_name%{REQUEST_URI}$char%{QUERY_STRING}\.$extension\.gz -s\n";
// $output['gzip'] .= " RewriteRule .* $cache_dir/%{ENV:boostpath}/$server_name%{REQUEST_URI}$char%{QUERY_STRING}\.$extension\.gz [L,T=$type,E=no-gzip:1]\n";
// $gzip_count++;
// }
$output['normal'] .= " RewriteCond $document_root$base_path$cache_dir/%{ENV:boostpath}/$server_name%{REQUEST_URI}$char%{QUERY_STRING}\.$extension -s\n";
$output['normal'] .= " RewriteRule .* $cache_dir/%{ENV:boostpath}/$server_name%{REQUEST_URI}$char%{QUERY_STRING}\.$extension [L,T=$type]\n";
$normal_count++;
}
$skip = !empty($gzip_count) ? $normal_count + $gzip_count + 1 : $normal_count;
// Generate the rules
$string = " ### BOOST START ###\n";
......@@ -233,11 +235,13 @@ function boost_admin_htaccess_generate_htaccess() {
$string .= " RewriteCond %{ENV:REDIRECT_STATUS} 200\n";
$string .= " RewriteRule .* - [S=$skip]\n";
$string .= "\n";
$string .= " # GZIP\n";
$string .= " RewriteCond %{HTTP:Accept-encoding} !gzip\n";
$string .= " RewriteRule .* - [S=$gzip_count]\n";
$string .= $output['gzip'];
$string .= "\n";
// Serving of .gz files disabled
// #1416214 - https://drupal.org/node/1416214#comment-7225650
// $string .= " # GZIP\n";
// $string .= " RewriteCond %{HTTP:Accept-encoding} !gzip\n";
// $string .= " RewriteRule .* - [S=$gzip_count]\n";
// $string .= $output['gzip'];
// $string .= "\n";
$string .= " # NORMAL\n";
$string .= $output['normal'];
}
......
......@@ -78,15 +78,15 @@ function boost_admin_settings() {
'#title' => t('Cache Enabled'),
'#default_value' => $values['enabled'],
);
// Enable gzip?
$form['cache_types'][$title][$type]['boost_gzip_' . $type] = array(
'#type' => 'checkbox',
'#title' => t('Enable gzip compression'),
'#description' => (BOOST_GZIP ? t('Avoids having to compress the content by the web server on every request (recommended).') : t('Your host does not support zlib. See: !url', array('!url' => 'http://www.php.net/manual/en/zlib.installation.php'))),
'#default_value' => (BOOST_GZIP ? $values['gzip'] : 0),
'#disabled' => ! BOOST_GZIP,
);
// https://drupal.org/node/1416214#comment-7225650
// // Enable gzip?
// $form['cache_types'][$title][$type]['boost_gzip_' . $type] = array(
// '#type' => 'checkbox',
// '#title' => t('Enable gzip compression'),
// '#description' => (BOOST_GZIP ? t('Avoids having to compress the content by the web server on every request (recommended).') : t('Your host does not support zlib. See: !url', array('!url' => 'http://www.php.net/manual/en/zlib.installation.php'))),
// '#default_value' => (BOOST_GZIP ? $values['gzip'] : 0),
// '#disabled' => ! BOOST_GZIP,
// );
// Content type extension
$form['cache_types'][$title][$type]['boost_extension_' . $type] = array(
......
......@@ -326,7 +326,7 @@ function boost_exit($destination = NULL) {
// Gzip support.
if (BOOST_GZIP && $_boost['matched_header_info']['gzip']) {
// #1416214
// #1416214 https://drupal.org/node/1416214#comment-7225650
// boost_write_file($_boost['filename'] . '.gz', gzencode($data, 9));
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment