Changeset 61038
- Timestamp:
- 10/21/2025 03:57:16 PM (5 weeks ago)
- Location:
- trunk
- Files:
-
- 1 deleted
- 7 edited
-
src/wp-includes/class-wp-metadata-lazyloader.php (modified) (1 diff)
-
src/wp-includes/pluggable.php (modified) (1 diff)
-
src/wp-includes/user.php (modified) (1 diff)
-
tests/phpunit/includes/abstract-testcase.php (modified) (1 diff)
-
tests/phpunit/tests/post/updatePostAuthorCaches.php (modified) (1 diff)
-
tests/phpunit/tests/query/cacheResults.php (modified) (1 diff)
-
tests/phpunit/tests/query/thePost.php (modified) (1 diff)
-
tests/phpunit/tests/user/lazyLoadMeta.php (deleted)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-metadata-lazyloader.php
r60989 r61038 66 66 'callback' => array( $this, 'lazyload_meta_callback' ), 67 67 ), 68 'user' => array(69 'filter' => 'get_user_metadata',70 'callback' => array( $this, 'lazyload_meta_callback' ),71 ),72 68 ); 73 69 } -
trunk/src/wp-includes/pluggable.php
r61010 r61038 126 126 global $wpdb; 127 127 128 $user_ids = array_unique( array_map( 'intval', $user_ids ), SORT_NUMERIC ); 129 wp_lazyload_user_meta( $user_ids ); 128 update_meta_cache( 'user', $user_ids ); 130 129 131 130 $clean = _get_non_cached_ids( $user_ids, 'users' ); -
trunk/src/wp-includes/user.php
r60996 r61038 1309 1309 function update_user_meta( $user_id, $meta_key, $meta_value, $prev_value = '' ) { 1310 1310 return update_metadata( 'user', $user_id, $meta_key, $meta_value, $prev_value ); 1311 }1312 1313 /**1314 * Queue user meta for lazy-loading.1315 *1316 * @since 6.9.01317 *1318 * @param int[] $user_ids List of user IDs.1319 */1320 function wp_lazyload_user_meta( array $user_ids ) {1321 if ( empty( $user_ids ) ) {1322 return;1323 }1324 $lazyloader = wp_metadata_lazyloader();1325 $lazyloader->queue_objects( 'user', $user_ids );1326 1311 } 1327 1312 -
trunk/tests/phpunit/includes/abstract-testcase.php
r61008 r61038 306 306 $lazyloader->reset_queue( 'comment' ); 307 307 $lazyloader->reset_queue( 'blog' ); 308 $lazyloader->reset_queue( 'user' );309 308 } 310 309 -
trunk/tests/phpunit/tests/post/updatePostAuthorCaches.php
r60989 r61038 68 68 } 69 69 70 $this->assertSame( 0, $action->get_call_count(), 'Ensure that user meta are not primed' );71 }72 73 /**74 * @ticket 6302175 */76 public function test_update_post_author_caches_force_load_meta() {77 $action = new MockAction();78 add_filter( 'update_user_metadata_cache', array( $action, 'filter' ), 10, 2 );79 80 $q = new WP_Query(81 array(82 'post_type' => 'post',83 'posts_per_page' => self::$post_author_count,84 )85 );86 87 while ( $q->have_posts() ) {88 $q->the_post();89 get_the_author_meta(); // Force loading of author meta.90 }91 92 70 $args = $action->get_args(); 93 71 $last_args = end( $args ); -
trunk/tests/phpunit/tests/query/cacheResults.php
r60989 r61038 1983 1983 $num_loop_queries = get_num_queries() - $start_loop_queries; 1984 1984 /* 1985 * One expected query: 1986 * 1: User data. 1985 * Two expected queries: 1986 * 1: User meta data, 1987 * 2: User data. 1987 1988 */ 1988 $this->assertSame( 1, $num_loop_queries, 'Unexpected number of queries while initializing the loop.' );1989 $this->assertSame( 2, $num_loop_queries, 'Unexpected number of queries while initializing the loop.' ); 1989 1990 1990 1991 $start_author_queries = get_num_queries(); -
trunk/tests/phpunit/tests/query/thePost.php
r60989 r61038 266 266 public function data_the_loop_fields() { 267 267 return array( 268 'all fields' => array( 'all', 1),269 'all fields (empty fields)' => array( '', 1),270 'post IDs' => array( 'ids', 3),271 'post ids and parent' => array( 'id=>parent', 3),268 'all fields' => array( 'all', 2 ), 269 'all fields (empty fields)' => array( '', 2 ), 270 'post IDs' => array( 'ids', 4 ), 271 'post ids and parent' => array( 'id=>parent', 4 ), 272 272 ); 273 273 }
Note: See TracChangeset
for help on using the changeset viewer.