-
Notifications
You must be signed in to change notification settings - Fork 110
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
Conversation
There was a problem hiding this 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' ) );
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @tillkruss!
perflab_disable_object_cache_dropin
filter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @tillkruss, LGTM!
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
[Focus]
orInfrastructure
label.[Type]
label.no milestone
label.