Ticket #18593: harden-cache.diff
File harden-cache.diff, 2.4 KB (added by , 14 years ago) |
---|
-
wp-includes/cache.php
24 24 function wp_cache_add($key, $data, $flag = '', $expire = 0) { 25 25 global $wp_object_cache; 26 26 27 return $wp_object_cache->add($key, $data, $flag, $expire); 27 if ( !empty( $wp_object_cache ) && method_exists( $wp_object_cache , 'add' ) ) 28 return $wp_object_cache->add($key, $data, $flag, $expire); 28 29 } 29 30 30 31 /** … … 57 58 function wp_cache_delete($id, $flag = '') { 58 59 global $wp_object_cache; 59 60 60 return $wp_object_cache->delete($id, $flag); 61 if ( !empty( $wp_object_cache ) && method_exists( $wp_object_cache , 'delete' ) ) 62 return $wp_object_cache->delete($id, $flag); 61 63 } 62 64 63 65 /** … … 72 74 function wp_cache_flush() { 73 75 global $wp_object_cache; 74 76 75 return $wp_object_cache->flush(); 77 if ( !empty( $wp_object_cache ) && method_exists( $wp_object_cache , 'flush' ) ) 78 return $wp_object_cache->flush(); 76 79 } 77 80 78 81 /** … … 90 93 function wp_cache_get($id, $flag = '') { 91 94 global $wp_object_cache; 92 95 93 return $wp_object_cache->get($id, $flag); 96 if ( !empty( $wp_object_cache ) ) 97 return $wp_object_cache->get($id, $flag); 94 98 } 95 99 96 100 /** … … 119 123 function wp_cache_replace($key, $data, $flag = '', $expire = 0) { 120 124 global $wp_object_cache; 121 125 122 return $wp_object_cache->replace($key, $data, $flag, $expire); 126 if ( !empty( $wp_object_cache ) && method_exists( $wp_object_cache , 'replace' ) ) 127 return $wp_object_cache->replace($key, $data, $flag, $expire); 123 128 } 124 129 125 130 /** … … 138 143 function wp_cache_set($key, $data, $flag = '', $expire = 0) { 139 144 global $wp_object_cache; 140 145 141 return $wp_object_cache->set($key, $data, $flag, $expire); 146 if ( !empty( $wp_object_cache ) ) 147 return $wp_object_cache->set($key, $data, $flag, $expire); 142 148 } 143 149 144 150 /** … … 151 157 function wp_cache_add_global_groups( $groups ) { 152 158 global $wp_object_cache; 153 159 154 return $wp_object_cache->add_global_groups($groups); 160 if ( !empty( $wp_object_cache ) && method_exists( $wp_object_cache , 'add_global_groups' ) ) 161 return $wp_object_cache->add_global_groups($groups); 155 162 } 156 163 157 164 /** … … 175 182 function wp_cache_reset() { 176 183 global $wp_object_cache; 177 184 178 return $wp_object_cache->reset(); 185 if ( !empty( $wp_object_cache ) && method_exists( $wp_object_cache , 'reset' ) ) 186 return $wp_object_cache->reset(); 179 187 } 180 188 181 189 /**