Make WordPress Core

Opened 17 months ago

Last modified 8 months 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: Future Release Priority: normal
Severity: normal Version:
Component: Script Loader Keywords: has-patch changes-requested
Focuses: Cc:

Description

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 (9)

#1 @azaozz
17 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.


17 months ago
#2

  • 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: https://core.trac.wordpress.org/ticket/58302

#3 @juzar
17 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' )
) {
	compression_test();
}

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
16 months ago

  • Keywords needs-testing added

#5 @azaozz
16 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
14 months 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: https://github.com/WordPress/wordpress-develop/blob/trunk/tests/phpunit/tests/ajax/wpAjaxWpCompressionTest.php

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

#7 @oglekler
13 months 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.

This ticket was mentioned in Slack in #core by audrasjb. View the logs.


8 months ago

#9 @audrasjb
8 months ago

  • Milestone changed from 6.5 to Future Release

From today's bug scrub:
As this is an enhancement and since we’re still waiting for an updated patch with the requested changes and addressing all the scope of the issue, let’s move it to Future release milestone.
Happy to review and move it back to milestone 6.5 if a complete patch is proposed during the alpha cycle.

Note: See TracTickets for help on using tickets.