Make WordPress Core

Opened 4 months ago

Last modified 2 days ago

#58302 new enhancement

Deprecate and disable the unused compression_test() and wp_ajax_wp_compression_test()

Reported by: azaozz's profile azaozz Owned by:
Milestone: 6.5 Priority: normal
Severity: normal Version:
Component: Script Loader Keywords: has-patch changes-requested
Focuses: Cc:


The functionality to test whether the web server compresses output was added 14 years ago (WP 2.8). At the time it wasn't a very common practice to compress web pages and assets on the server level, and compressing scripts and stylesheets in PHP was considered a good page load speed increase.

Over the years this has changed. Now most (nearly all?) servers compress output, and compressing from PHP is considered "bad practice" as it is slower and consumes more resources. For that reason the compression of the (concatenated) scripts and stylesheets was removed from load-scripts.php and load-styles.php in [43580] about 4 years ago. Since then the above functionality has been unused.

Change History (7)

#1 @azaozz
4 months ago

Looking at how to maintain backwards compatibility it seems the can_compress_scripts option should still exist. The $compress_scripts and $compress_css globals in script_concat_settings() should still respect COMPRESS_SCRIPTS and COMPRESS_CSS when defined, but should default to false.

This ticket was mentioned in PR #4502 on WordPress/wordpress-develop by Juzar10.

4 months ago

  • Keywords has-patch added
  • Deprecated compression_test and wp_ajax_compression_test functions by adding the _deprecated_function() for both of them and moved those functions to the deprecated.php file.
  • made the default false for the $compress_scripts and $compress_css in the script_concat_settings function.

Trac ticket:

#3 @juzar
4 months ago

Hello @azaozz,
I looked into deprecate these functions and created the patch, the function compression_test is being used in the wp-admin/admin-footer.php file on line:107 which is causing the performance test to fail.

// get_site_option() won't exist when auto upgrading from <= 2.7.
if ( function_exists( 'get_site_option' )
	&& false === get_site_option( 'can_compress_scripts' )
) {

I think removing this block of code would fix the e2e testing issue.

Please correct me if I am going in the wrong direction with this.

#4 @oglekler
3 months ago

  • Keywords needs-testing added

#5 @azaozz
3 months ago

  • Milestone changed from 6.3 to 6.4

Seems this needs more research. Lets look at it again in 6.4.

#6 @oglekler
5 weeks ago

  • Keywords changes-requested added; needs-testing removed

Apart from the compression_test() in admin-footer.php, we also have Unit tests dedicated to this compression:

@azaozz how we can proceed, can we just remove them?

#7 @oglekler
2 days ago

  • Milestone changed from 6.4 to 6.5

Due to lack of activity in 4 months and coming up Beta 1, I am moving this enhancement into the next milestone.

Note: See TracTickets for help on using tickets.