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: |
|
Owned by: | |
---|---|---|---|
Milestone: | 6.5 | 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 (7)
This ticket was mentioned in PR #4502 on WordPress/wordpress-develop by Juzar10.
4 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 thescript_concat_settings
function.
Trac ticket: https://core.trac.wordpress.org/ticket/58302
#3
@
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' ) ) { 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.
#5
@
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
@
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: https://github.com/WordPress/wordpress-develop/blob/trunk/tests/phpunit/tests/ajax/wpAjaxWpCompressionTest.php
@azaozz how we can proceed, can we just remove them?
Looking at how to maintain backwards compatibility it seems the
can_compress_scripts
option should still exist. The$compress_scripts
and$compress_css
globals inscript_concat_settings()
should still respectCOMPRESS_SCRIPTS
andCOMPRESS_CSS
when defined, but should default tofalse
.