Skip to content

Commit d371a8d

Browse files
committed
Allow opt-in object-cache.php drop-in placement via PERFLAB_PLACE_OBJECT_CACHE_DROPIN constant
1 parent ff8b62b commit d371a8d

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

plugins/performance-lab/load.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,9 @@ function perflab_get_standalone_plugin_version_constants(): array {
145145
* the frontend.
146146
*
147147
* This function will short-circuit if at least one of the constants
148-
* 'PERFLAB_DISABLE_SERVER_TIMING' or 'PERFLAB_DISABLE_OBJECT_CACHE_DROPIN' is
149-
* set as true.
148+
* 'PERFLAB_DISABLE_SERVER_TIMING' or
149+
* 'PERFLAB_DISABLE_OBJECT_CACHE_DROPIN' is set as true or if the
150+
* 'PERFLAB_PLACE_OBJECT_CACHE_DROPIN' constant is not set to a truthy value.
150151
*
151152
* @since 1.8.0
152153
* @since 2.1.0 No longer attempts to use two of the drop-ins together.
@@ -156,6 +157,11 @@ function perflab_get_standalone_plugin_version_constants(): array {
156157
function perflab_maybe_set_object_cache_dropin(): void {
157158
global $wp_filesystem;
158159

160+
// Bail if the drop-in is not enabled.
161+
if ( ! defined( 'PERFLAB_PLACE_OBJECT_CACHE_DROPIN' ) || ! PERFLAB_PLACE_OBJECT_CACHE_DROPIN ) {
162+
return;
163+
}
164+
159165
// Bail if Server-Timing is disabled entirely.
160166
if ( defined( 'PERFLAB_DISABLE_SERVER_TIMING' ) && PERFLAB_DISABLE_SERVER_TIMING ) {
161167
return;

0 commit comments

Comments
 (0)