Skip to content

Commit 9bcfdaf

Browse files
authored
Merge pull request #45 from ocean90/fix/wp_using_ext_object_cache
Replace usage of private global with wp_using_ext_object_cache()
2 parents 65866ba + 6261f2f commit 9bcfdaf

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/Transient_Command.php

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -210,12 +210,11 @@ public function delete( $args, $assoc_args ) {
210210
* Transients are saved to the database.
211211
*/
212212
public function type() {
213-
global $_wp_using_ext_object_cache;
214-
215-
if ( $_wp_using_ext_object_cache )
213+
if ( wp_using_ext_object_cache() ) {
216214
$message = 'Transients are saved to the object cache.';
217-
else
215+
} else {
218216
$message = 'Transients are saved to the database.';
217+
}
219218

220219
WP_CLI::line( $message );
221220
}
@@ -224,7 +223,7 @@ public function type() {
224223
* Deletes all expired transients.
225224
*/
226225
private function delete_expired() {
227-
global $wpdb, $_wp_using_ext_object_cache;
226+
global $wpdb;
228227

229228
// Always delete all transients from DB too.
230229
$time = current_time('timestamp');
@@ -242,7 +241,7 @@ private function delete_expired() {
242241
WP_CLI::success( "No expired transients found." );
243242
}
244243

245-
if ( $_wp_using_ext_object_cache ) {
244+
if ( wp_using_ext_object_cache() ) {
246245
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.');
247246
}
248247
}
@@ -251,7 +250,7 @@ private function delete_expired() {
251250
* Deletes all transients.
252251
*/
253252
private function delete_all() {
254-
global $wpdb, $_wp_using_ext_object_cache;
253+
global $wpdb;
255254

256255
// Always delete all transients from DB too.
257256
$count = $wpdb->query(
@@ -266,7 +265,7 @@ private function delete_all() {
266265
WP_CLI::success( "No transients found." );
267266
}
268267

269-
if ( $_wp_using_ext_object_cache ) {
268+
if ( wp_using_ext_object_cache() ) {
270269
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.');
271270
}
272271
}

0 commit comments

Comments
 (0)