Skip to content

Commit 71f4ede

Browse files
author
Hai Zheng
committed
v7.9-a15: Dropped unnecessary func for OC.
1 parent 363ab70 commit 71f4ede

2 files changed

Lines changed: 15 additions & 18 deletions

File tree

src/object-cache.cls.php

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,6 @@
1212

1313
require_once dirname( __DIR__ ) . '/autoload.php';
1414

15-
if ( ! function_exists( 'litespeed_oc_disable_ext_cache' ) ) {
16-
/**
17-
* Disable external object cache flag.
18-
*
19-
* When called, WP's own set_transient/get_transient will use wp_options
20-
* table instead of the (unavailable) OC backend.
21-
*
22-
* @since 7.8.0.1
23-
* @access public
24-
*/
25-
function litespeed_oc_disable_ext_cache() {
26-
wp_using_ext_object_cache( false );
27-
}
28-
}
29-
3015
/**
3116
* Object cache handler using Redis or Memcached.
3217
*
@@ -594,9 +579,15 @@ private function _connect() {
594579
// After muplugins_loaded, all wp_start_object_cache() calls are done — safe to call directly.
595580
// Before that (early bootstrap), defer via hook to avoid multisite "Cannot redeclare" fatal.
596581
if ( function_exists( 'did_action' ) && did_action( 'muplugins_loaded' ) ) {
597-
litespeed_oc_disable_ext_cache();
582+
wp_using_ext_object_cache( false );
598583
} elseif ( function_exists( 'add_action' ) ) {
599-
add_action( 'muplugins_loaded', 'litespeed_oc_disable_ext_cache', -999 );
584+
add_action(
585+
'muplugins_loaded',
586+
function () {
587+
wp_using_ext_object_cache( false );
588+
},
589+
-999
590+
);
600591
}
601592

602593
return false;

src/object.lib.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,13 @@ function wp_cache_init() {
4949
// and would try to load cache.php, causing "Cannot redeclare wp_cache_init()".
5050
// Defer until after all wp_start_object_cache() calls are done.
5151
if ( defined( 'LITESPEED_OC_FAILURE' ) ) {
52-
add_action( 'muplugins_loaded', 'litespeed_oc_disable_ext_cache', -999 );
52+
add_action(
53+
'muplugins_loaded',
54+
function () {
55+
wp_using_ext_object_cache( false );
56+
},
57+
-999
58+
);
5359
}
5460
}
5561

0 commit comments

Comments
 (0)