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

Add perflab_disable_object_cache_dropin filter #629

Merged
merged 7 commits into from
Jan 31, 2023
Merged

Conversation

tillkruss
Copy link
Member

@tillkruss tillkruss commented Jan 24, 2023

Summary

Fixes #628 and #629.

Relevant technical choices

Using a filter is easy for other plugin to use, while the existing constant would need to be set in the wp-config.php which isn't easily controlled by a plugin.

Checklist

  • PR has either [Focus] or Infrastructure label.
  • PR has a [Type] label.
  • PR has a milestone or the no milestone label.

Sorry, something went wrong.

@tillkruss tillkruss added [Type] Enhancement A suggestion for improvement of an existing feature [Focus] Measurement labels Jan 24, 2023
@tillkruss tillkruss added this to the 2.0.0 milestone Jan 24, 2023
@tillkruss tillkruss changed the title Update load.php Add object cache drop-in filter Jan 24, 2023
@tillkruss tillkruss changed the title Add object cache drop-in filter Add server timing drop-in filter Jan 24, 2023
Copy link
Member

@felixarntz felixarntz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tillkruss Two minor points of feedback here, also can you please add a test covering the filter?

E.g. like this:

	public function test_perflab_maybe_set_object_cache_dropin_disabled_via_filter() {
		global $wp_filesystem;

		$this->set_up_mock_filesystem();

		// Ensure PL object-cache.php drop-in is not present and constant is not set.
		$this->assertFalse( $wp_filesystem->exists( WP_CONTENT_DIR . '/object-cache.php' ) );
		$this->assertFalse( PERFLAB_OBJECT_CACHE_DROPIN_VERSION );

		// Add filter to disable drop-in.
		add_filter( 'perflab_disable_object_cache_dropin', '__return_true' );

		// Run function to place drop-in and ensure it still doesn't exist afterwards.
		perflab_maybe_set_object_cache_dropin();
		$this->assertFalse( $wp_filesystem->exists( WP_CONTENT_DIR . '/object-cache.php' ) );
	}

tillkruss and others added 4 commits January 27, 2023 10:03
Co-authored-by: Felix Arntz <felixarntz@users.noreply.github.com>
Co-authored-by: Felix Arntz <felixarntz@users.noreply.github.com>
Copy link
Member

@felixarntz felixarntz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @tillkruss!

@felixarntz felixarntz changed the title Add server timing drop-in filter Add perflab_disable_object_cache_dropin filter Jan 27, 2023
Copy link
Member

@mukeshpanchal27 mukeshpanchal27 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @tillkruss, LGTM!

@mukeshpanchal27 mukeshpanchal27 merged commit af20ea6 into trunk Jan 31, 2023
@mukeshpanchal27 mukeshpanchal27 deleted the fix-628 branch January 31, 2023 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Enhancement A suggestion for improvement of an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Disable Server Timing via filter
4 participants