Ticket #14047: 14047.diff
| File 14047.diff, 2.8 KB (added by wojtek.szkutnik, 3 years ago) |
|---|
-
cache.php
23 23 */ 24 24 function wp_cache_add($key, $data, $flag = '', $expire = 0) { 25 25 global $wp_object_cache; 26 27 return $wp_object_cache->add($key, $data, $flag, $expire); 26 27 if ( is_object( $wp_object_cache ) && method_exists( $wp_object_cache, 'add' ) ) 28 return $wp_object_cache->add($key, $data, $flag, $expire); 29 30 return false; 28 31 } 29 32 30 33 /** … … 56 59 */ 57 60 function wp_cache_delete($id, $flag = '') { 58 61 global $wp_object_cache; 59 60 return $wp_object_cache->delete($id, $flag); 62 63 if ( is_object( $wp_object_cache ) && method_exists( $wp_object_cache, 'delete' ) ) 64 return $wp_object_cache->delete($id, $flag); 65 66 return false; 61 67 } 62 68 63 69 /** … … 67 73 * @uses $wp_object_cache Object Cache Class 68 74 * @see WP_Object_Cache::flush() 69 75 * 70 * @return bool Always returns true76 * @return bool Returns true on success, false if cache doesn't exist 71 77 */ 72 78 function wp_cache_flush() { 73 79 global $wp_object_cache; 74 75 return $wp_object_cache->flush(); 80 81 if ( is_object( $wp_object_cache ) && method_exists( $wp_object_cache, 'flush' ) ) 82 return $wp_object_cache->flush(); 83 84 return false; 76 85 } 77 86 78 87 /** … … 89 98 */ 90 99 function wp_cache_get($id, $flag = '') { 91 100 global $wp_object_cache; 92 93 return $wp_object_cache->get($id, $flag); 101 102 if ( is_object( $wp_object_cache ) && method_exists( $wp_object_cache, 'get' ) ) 103 return $wp_object_cache->get($id, $flag); 104 105 return false; 94 106 } 95 107 96 108 /** … … 119 131 function wp_cache_replace($key, $data, $flag = '', $expire = 0) { 120 132 global $wp_object_cache; 121 133 122 return $wp_object_cache->replace($key, $data, $flag, $expire); 134 if ( is_object( $wp_object_cache ) && method_exists( $wp_object_cache, 'replace' ) ) 135 return $wp_object_cache->replace($key, $data, $flag, $expire); 136 137 return false; 123 138 } 124 139 125 140 /** … … 138 153 function wp_cache_set($key, $data, $flag = '', $expire = 0) { 139 154 global $wp_object_cache; 140 155 141 return $wp_object_cache->set($key, $data, $flag, $expire); 156 if ( is_object( $wp_object_cache ) && method_exists( $wp_object_cache, 'set' ) ) 157 return $wp_object_cache->set($key, $data, $flag, $expire); 158 159 return false; 142 160 } 143 161 144 162 /** … … 151 169 function wp_cache_add_global_groups( $groups ) { 152 170 global $wp_object_cache; 153 171 154 return $wp_object_cache->add_global_groups($groups); 172 if ( is_object( $wp_object_cache ) && method_exists( $wp_object_cache, 'add_global_groups' ) ) 173 return $wp_object_cache->add_global_groups($groups); 174 175 return false; 155 176 } 156 177 157 178 /** … … 177 198 function wp_cache_reset() { 178 199 global $wp_object_cache; 179 200 180 return $wp_object_cache->reset(); 201 if ( is_object( $wp_object_cache ) && method_exists( $wp_object_cache, 'reset' ) ) 202 return $wp_object_cache->reset(); 203 204 return false; 181 205 } 182 206 183 207 /**
