| 1 | Index: wp-includes/cache.php |
|---|
| 2 | =================================================================== |
|---|
| 3 | --- wp-includes/cache.php (revision 18557) |
|---|
| 4 | +++ wp-includes/cache.php (working copy) |
|---|
| 5 | @@ -24,7 +24,8 @@ |
|---|
| 6 | function wp_cache_add($key, $data, $flag = '', $expire = 0) { |
|---|
| 7 | global $wp_object_cache; |
|---|
| 8 | |
|---|
| 9 | - return $wp_object_cache->add($key, $data, $flag, $expire); |
|---|
| 10 | + if ( !empty( $wp_object_cache ) && method_exists( $wp_object_cache , 'add' ) ) |
|---|
| 11 | + return $wp_object_cache->add($key, $data, $flag, $expire); |
|---|
| 12 | } |
|---|
| 13 | |
|---|
| 14 | /** |
|---|
| 15 | @@ -57,7 +58,8 @@ |
|---|
| 16 | function wp_cache_delete($id, $flag = '') { |
|---|
| 17 | global $wp_object_cache; |
|---|
| 18 | |
|---|
| 19 | - return $wp_object_cache->delete($id, $flag); |
|---|
| 20 | + if ( !empty( $wp_object_cache ) && method_exists( $wp_object_cache , 'delete' ) ) |
|---|
| 21 | + return $wp_object_cache->delete($id, $flag); |
|---|
| 22 | } |
|---|
| 23 | |
|---|
| 24 | /** |
|---|
| 25 | @@ -72,7 +74,8 @@ |
|---|
| 26 | function wp_cache_flush() { |
|---|
| 27 | global $wp_object_cache; |
|---|
| 28 | |
|---|
| 29 | - return $wp_object_cache->flush(); |
|---|
| 30 | + if ( !empty( $wp_object_cache ) && method_exists( $wp_object_cache , 'flush' ) ) |
|---|
| 31 | + return $wp_object_cache->flush(); |
|---|
| 32 | } |
|---|
| 33 | |
|---|
| 34 | /** |
|---|
| 35 | @@ -90,7 +93,8 @@ |
|---|
| 36 | function wp_cache_get($id, $flag = '') { |
|---|
| 37 | global $wp_object_cache; |
|---|
| 38 | |
|---|
| 39 | - return $wp_object_cache->get($id, $flag); |
|---|
| 40 | + if ( !empty( $wp_object_cache ) ) |
|---|
| 41 | + return $wp_object_cache->get($id, $flag); |
|---|
| 42 | } |
|---|
| 43 | |
|---|
| 44 | /** |
|---|
| 45 | @@ -119,7 +123,8 @@ |
|---|
| 46 | function wp_cache_replace($key, $data, $flag = '', $expire = 0) { |
|---|
| 47 | global $wp_object_cache; |
|---|
| 48 | |
|---|
| 49 | - return $wp_object_cache->replace($key, $data, $flag, $expire); |
|---|
| 50 | + if ( !empty( $wp_object_cache ) && method_exists( $wp_object_cache , 'replace' ) ) |
|---|
| 51 | + return $wp_object_cache->replace($key, $data, $flag, $expire); |
|---|
| 52 | } |
|---|
| 53 | |
|---|
| 54 | /** |
|---|
| 55 | @@ -138,7 +143,8 @@ |
|---|
| 56 | function wp_cache_set($key, $data, $flag = '', $expire = 0) { |
|---|
| 57 | global $wp_object_cache; |
|---|
| 58 | |
|---|
| 59 | - return $wp_object_cache->set($key, $data, $flag, $expire); |
|---|
| 60 | + if ( !empty( $wp_object_cache ) ) |
|---|
| 61 | + return $wp_object_cache->set($key, $data, $flag, $expire); |
|---|
| 62 | } |
|---|
| 63 | |
|---|
| 64 | /** |
|---|
| 65 | @@ -151,7 +157,8 @@ |
|---|
| 66 | function wp_cache_add_global_groups( $groups ) { |
|---|
| 67 | global $wp_object_cache; |
|---|
| 68 | |
|---|
| 69 | - return $wp_object_cache->add_global_groups($groups); |
|---|
| 70 | + if ( !empty( $wp_object_cache ) && method_exists( $wp_object_cache , 'add_global_groups' ) ) |
|---|
| 71 | + return $wp_object_cache->add_global_groups($groups); |
|---|
| 72 | } |
|---|
| 73 | |
|---|
| 74 | /** |
|---|
| 75 | @@ -175,7 +182,8 @@ |
|---|
| 76 | function wp_cache_reset() { |
|---|
| 77 | global $wp_object_cache; |
|---|
| 78 | |
|---|
| 79 | - return $wp_object_cache->reset(); |
|---|
| 80 | + if ( !empty( $wp_object_cache ) && method_exists( $wp_object_cache , 'reset' ) ) |
|---|
| 81 | + return $wp_object_cache->reset(); |
|---|
| 82 | } |
|---|
| 83 | |
|---|
| 84 | /** |
|---|