Make WordPress Core


Ignore:
Timestamp:
08/20/2018 01:50:49 PM (6 years ago)
Author:
azaozz
Message:

Script loader: remove (PHP based) compression from load-styles.php and load-scripts.php. WIth the amount of scripts and stylesheets grown a lot over the years, it has become pretty slow and consumes a lot of server resources. Also, most servers are set to compress PHP output anyway.

Props LucasRolff, azaozz.

Fixes #44815.
See #43308.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/load-scripts.php

    r42343 r43580  
    3131require( ABSPATH . WPINC . '/version.php' );
    3232
    33 $compress       = ( isset( $_GET['c'] ) && $_GET['c'] );
    34 $force_gzip     = ( $compress && 'gzip' == $_GET['c'] );
    3533$expires_offset = 31536000; // 1 year
    3634$out            = '';
     
    6260header( "Cache-Control: public, max-age=$expires_offset" );
    6361
    64 if ( $compress && ! ini_get( 'zlib.output_compression' ) && 'ob_gzhandler' != ini_get( 'output_handler' ) && isset( $_SERVER['HTTP_ACCEPT_ENCODING'] ) ) {
    65     header( 'Vary: Accept-Encoding' ); // Handle proxies
    66     if ( false !== stripos( $_SERVER['HTTP_ACCEPT_ENCODING'], 'deflate' ) && function_exists( 'gzdeflate' ) && ! $force_gzip ) {
    67         header( 'Content-Encoding: deflate' );
    68         $out = gzdeflate( $out, 3 );
    69     } elseif ( false !== stripos( $_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip' ) && function_exists( 'gzencode' ) ) {
    70         header( 'Content-Encoding: gzip' );
    71         $out = gzencode( $out, 3 );
    72     }
    73 }
    74 
    7562echo $out;
    7663exit;
Note: See TracChangeset for help on using the changeset viewer.