Skip to content

Commit 1e80058

Browse files
committed
Replace usage of private global with wp_using_ext_object_cache()
1 parent 92d7af8 commit 1e80058

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/Transient_Command.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -210,12 +210,13 @@ public function delete( $args, $assoc_args ) {
210210
* Transients are saved to the wp_options table.
211211
*/
212212
public function type() {
213-
global $_wp_using_ext_object_cache, $wpdb;
213+
global $wpdb;
214214

215-
if ( $_wp_using_ext_object_cache )
215+
if ( wp_using_ext_object_cache() ) {
216216
$message = 'Transients are saved to the object cache.';
217-
else
217+
} else {
218218
$message = 'Transients are saved to the ' . $wpdb->prefix . 'options table.';
219+
}
219220

220221
WP_CLI::line( $message );
221222
}
@@ -224,7 +225,7 @@ public function type() {
224225
* Deletes all expired transients.
225226
*/
226227
private function delete_expired() {
227-
global $wpdb, $_wp_using_ext_object_cache;
228+
global $wpdb;
228229

229230
// Always delete all transients from DB too.
230231
$time = current_time('timestamp');
@@ -242,7 +243,7 @@ private function delete_expired() {
242243
WP_CLI::success( "No expired transients found." );
243244
}
244245

245-
if ( $_wp_using_ext_object_cache ) {
246+
if ( wp_using_ext_object_cache() ) {
246247
WP_CLI::warning( 'Transients are stored in an external object cache, and this command only deletes those stored in the database. You must flush the cache to delete all transients.');
247248
}
248249
}
@@ -251,7 +252,7 @@ private function delete_expired() {
251252
* Deletes all transients.
252253
*/
253254
private function delete_all() {
254-
global $wpdb, $_wp_using_ext_object_cache;
255+
global $wpdb;
255256

256257
// Always delete all transients from DB too.
257258
$count = $wpdb->query(
@@ -266,7 +267,7 @@ private function delete_all() {
266267
WP_CLI::success( "No transients found." );
267268
}
268269

269-
if ( $_wp_using_ext_object_cache ) {
270+
if ( wp_using_ext_object_cache() ) {
270271
WP_CLI::warning( 'Transients are stored in an external object cache, and this command only deletes those stored in the database. You must flush the cache to delete all transients.');
271272
}
272273
}

0 commit comments

Comments
 (0)