diff --git a/wp-includes/deprecated.php b/wp-includes/deprecated.php index 3b4dc8d26..db137793e 100644 --- a/wp-includes/deprecated.php +++ b/wp-includes/deprecated.php @@ -57,3 +57,30 @@ function wp_service_worker_json_encode( $data ) { _deprecated_function( __FUNCTION__, '0.6', 'wp_json_encode()' ); return wp_json_encode( $data, 128 | 64 /* JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES */ ); } + +/** + * Disables concatenating scripts to leverage caching the assets via Service Worker instead. + * + * @deprecated 0.7 No longer used. + */ +function wp_disable_script_concatenation() { + _deprecated_function( __FUNCTION__, '0.7' ); + + global $concatenate_scripts; + + /* + * This cookie is set when the service worker registers successfully, avoiding unnecessary result + * for browsers that don't support service workers. Note that concatenation only applies in the admin, + * for authenticated users without full-page caching. + */ + if ( isset( $_COOKIE['wordpress_sw_installed'] ) ) { + $concatenate_scripts = false; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited + } + + // phpcs:disable + // @todo This is just here for debugging purposes. + if ( isset( $_GET['wp_concatenate_scripts'] ) ) { + $concatenate_scripts = rest_sanitize_boolean( $_GET['wp_concatenate_scripts'] ); + } + // phpcs:enable +}