Skip to content

Commit

Permalink
Eliminate disabling script concatenation when SW installed since prec…
Browse files Browse the repository at this point in the history
…aching not used
  • Loading branch information
westonruter committed Jul 26, 2021
1 parent 487637f commit 591c7a3
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 25 deletions.
2 changes: 0 additions & 2 deletions wp-includes/default-filters.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,3 @@
add_action( 'wp_head', 'wp_add_error_template_no_robots' );
add_action( 'error_head', 'wp_add_error_template_no_robots' );
}

add_action( 'admin_init', 'wp_disable_script_concatenation' );
23 changes: 0 additions & 23 deletions wp-includes/service-workers.php
Original file line number Diff line number Diff line change
Expand Up @@ -228,29 +228,6 @@ function wp_ajax_wp_service_worker() {
die();
}

/**
* Disables concatenating scripts to leverage caching the assets via Service Worker instead.
*/
function wp_disable_script_concatenation() {
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
}

/**
* Checks if Service Worker should skip waiting in case of update and update automatically.
*
Expand Down

0 comments on commit 591c7a3

Please sign in to comment.