Ticket #15545: 15545.diff
File 15545.diff, 2.0 KB (added by , 14 years ago) |
---|
-
wp-includes/user.php
1037 1037 foreach ( $ids as $id ) 1038 1038 $objects[$id] = array(); 1039 1039 1040 update_meta_cache('user', $ids);1040 $metas = update_meta_cache('user', $ids); 1041 1041 1042 foreach ( $ids as $id ) { 1043 $meta = get_metadata('user', $id); 1042 foreach ( $metas as $id => $meta ) { 1044 1043 foreach ( $meta as $key => $metavalues ) { 1045 1044 foreach ( $metavalues as $value ) { 1046 1045 $objects[$id][] = (object)array( 'user_id' => $id, 'meta_key' => $key, 'meta_value' => $value); -
wp-includes/meta.php
259 259 $meta_cache = wp_cache_get($object_id, $meta_type . '_meta'); 260 260 261 261 if ( !$meta_cache ) { 262 update_meta_cache($meta_type, $object_id);263 $meta_cache = wp_cache_get($object_id, $meta_type . '_meta');262 $meta_cache = update_meta_cache( $meta_type, array( $object_id ) ); 263 $meta_cache = $meta_cache[$object_id]; 264 264 } 265 265 266 266 if ( !$meta_key ) … … 309 309 310 310 $cache_key = $meta_type . '_meta'; 311 311 $ids = array(); 312 $cache = array(); 312 313 foreach ( $object_ids as $id ) { 313 if ( false === wp_cache_get($id, $cache_key) ) 314 $cached_object = wp_cache_get( $id, $cache_key ); 315 if ( false === $cached_object ) 314 316 $ids[] = $id; 317 else 318 $cache[$id] = $cached_object; 315 319 } 316 320 317 321 if ( empty( $ids ) ) 318 return false;322 return $cache; 319 323 320 324 // Get meta info 321 325 $id_list = join(',', $ids); 322 $cache = array();323 326 $meta_list = $wpdb->get_results( $wpdb->prepare("SELECT $column, meta_key, meta_value FROM $table WHERE $column IN ($id_list)", 324 327 $meta_type), ARRAY_A ); 325 328 … … 343 346 foreach ( $ids as $id ) { 344 347 if ( ! isset($cache[$id]) ) 345 348 $cache[$id] = array(); 349 wp_cache_add( $id, $cache[$id], $cache_key ); 346 350 } 347 351 348 foreach ( array_keys($cache) as $object)349 wp_cache_add($object, $cache[$object], $cache_key);350 351 352 return $cache; 352 353 } 353 354