Skip to content

Commit

Permalink
Move wp_disable_script_concatenation() to deprecated.php
Browse files Browse the repository at this point in the history
  • Loading branch information
westonruter committed Jul 26, 2021
1 parent 4c3da17 commit 56f1611
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions wp-includes/deprecated.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit 56f1611

Please sign in to comment.