Skip to content
Snippets Groups Projects
Commit a2551812 authored by catch's avatar catch
Browse files

Issue #2183075 by valderama, dinarcon, er.pushpinderrana, amitgoyal,...

Issue #2183075 by valderama, dinarcon, er.pushpinderrana, amitgoyal, umar-ahmad: Tidy up css.gzip and js.gzip configuration.
parent 2d3266e6
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -2237,8 +2237,8 @@ function drupal_clear_js_cache() {
*/
function drupal_page_set_cache(Response $response, Request $request) {
// Check if the current page may be compressed.
if (\Drupal::config('system.performance')->get('response.gzip') &&
!$response->headers->get('Content-Encoding') && extension_loaded('zlib')) {
if (extension_loaded('zlib') && !$response->headers->get('Content-Encoding') &&
\Drupal::config('system.performance')->get('response.gzip')) {
$content = $response->getContent();
if ($content) {
......
......@@ -41,7 +41,7 @@ public function dump($data, $file_extension) {
// file) in generating the file anyway. Sites on servers where rewrite rules
// aren't working can set css.gzip to FALSE in order to skip
// generating a file that won't be used.
if (\Drupal::config('system.performance')->get($file_extension . '.gzip') && extension_loaded('zlib')) {
if (extension_loaded('zlib') && \Drupal::config('system.performance')->get($file_extension . '.gzip')) {
if (!file_exists($uri . '.gz') && !file_unmanaged_save_data(gzencode($data, 9, FORCE_GZIP), $uri . '.gz', FILE_EXISTS_REPLACE)) {
return FALSE;
}
......
......@@ -585,21 +585,6 @@
# $config['system.theme']['default'] = 'stark';
# $config['user.settings']['anonymous'] = 'Visitor';
/**
* CSS/JS aggregated file gzip compression:
*
* By default, when CSS or JS aggregation and clean URLs are enabled Drupal will
* store a gzip compressed (.gz) copy of the aggregated files. If this file is
* available then rewrite rules in the default .htaccess file will serve these
* files to browsers that accept gzip encoded content. This allows pages to load
* faster for these users and has minimal impact on server load. If you are
* using a webserver other than Apache httpd, or a caching reverse proxy that is
* configured to cache and compress these files itself you may want to uncomment
* one or both of the below lines, which will prevent gzip files being stored.
*/
# $config['system.performance']['css']['gzip'] = FALSE;
# $config['system.performance']['js']['gzip'] = FALSE;
/**
* Fast 404 pages:
*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment