Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Fixes #6972 Prevent injecting Beacon script when DONOTROCKETOPTIMIZE is defined #7037

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions inc/Engine/Common/PerformanceHints/Frontend/Processor.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,6 @@ public function maybe_apply_optimizations( string $html ): string {
* @return string The modified HTML content with the beacon script injected just before the closing body tag.
*/
private function inject_beacon( $html, $url, $is_mobile ): string {
if ( rocket_get_constant( 'DONOTROCKETOPTIMIZE' ) ) {
return $html;
}

$min = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';

if ( ! $this->filesystem->exists( rocket_get_constant( 'WP_ROCKET_ASSETS_JS_PATH' ) . 'wpr-beacon' . $min . '.js' ) ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,19 +68,6 @@
],
'expected' => $html_input,
],
'shouldReturnOriginalWhenDonotoptimize' => [
'config' => [
'donotrocketoptimize' => true,
'html' => $html_input,
'atf' => [
'row' => null,
],
'lrc' => [
'row' => null,
],
],
'expected' => $html_input,
],
'shouldAddBeaconToPage' => [
'config' => [
'html' => $html_input,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ public function tear_down() {
public function testShouldReturnAsExpected( $config, $expected ) {
$this->config = $config;
$this->cached_user = $config['user_cache_enabled'] ?? false;
$this->donotrocketoptimize = $config['donotrocketoptimize'] ?? null;

if ( isset( $config['query_string'] ) ) {
$_GET[ $config['query_string'] ] = 1;
Expand Down
Loading