Make WordPress Core

Ticket #58301: 58301.2.diff

File 58301.2.diff, 3.5 KB (added by sh4lin, 20 months ago)
Line 
1diff --git src/wp-admin/includes/deprecated.php src/wp-admin/includes/deprecated.php
2index 04f7208422..ae3b3996e7 100644
3--- src/wp-admin/includes/deprecated.php
4+++ src/wp-admin/includes/deprecated.php
5@@ -1588,3 +1588,29 @@ function image_attachment_fields_to_save( $post, $attachment ) {
6 
7        return $post;
8 }
9+
10+/**
11+ * Queues comments for metadata lazy-loading.
12+ *
13+ * @since 4.5.0
14+ * @since 6.3.0 Use wp_lazyload_comment_meta() for lazy-loading of comment meta.
15+ * @deprecated 6.3.0 Use wp_lazyload_comment_meta() instead.
16+ *
17+ * @see wp_lazyload_comment_meta()
18+ *
19+ * @param WP_Comment[] $comments Array of comment objects.
20+ */
21+function wp_queue_comments_for_comment_meta_lazyload( $comments ) {
22+       _deprecated_function( __FUNCTION__, '6.3.0', 'wp_lazyload_comment_meta' );
23+       // Don't use `wp_list_pluck()` to avoid by-reference manipulation.
24+       $comment_ids = array();
25+       if ( is_array( $comments ) ) {
26+               foreach ( $comments as $comment ) {
27+                       if ( $comment instanceof WP_Comment ) {
28+                               $comment_ids[] = $comment->comment_ID;
29+                       }
30+               }
31+       }
32+
33+       wp_lazyload_comment_meta( $comment_ids );
34+}
35diff --git src/wp-includes/class-wp-query.php src/wp-includes/class-wp-query.php
36index 38b89601fb..052f226b06 100644
37--- src/wp-includes/class-wp-query.php
38+++ src/wp-includes/class-wp-query.php
39@@ -4891,7 +4879,7 @@ class WP_Query {
40         * Lazyload comment meta for comments in the loop.
41         *
42         * @since 4.4.0
43-        * @deprecated 4.5.0 See wp_queue_comments_for_comment_meta_lazyload().
44+        * @deprecated 4.5.0 See wp_lazyload_comment_meta().
45         *
46         * @param mixed $check
47         * @param int   $comment_id
48diff --git src/wp-includes/comment.php src/wp-includes/comment.php
49index b6f5420577..5d87da2890 100644
50--- src/wp-includes/comment.php
51+++ src/wp-includes/comment.php
52@@ -525,30 +525,6 @@ function update_comment_meta( $comment_id, $meta_key, $meta_value, $prev_value =
53        return update_metadata( 'comment', $comment_id, $meta_key, $meta_value, $prev_value );
54 }
55 
56-/**
57- * Queues comments for metadata lazy-loading.
58- *
59- * @since 4.5.0
60- * @since 6.3.0 Use wp_lazyload_comment_meta() for lazy-loading of comment meta.
61- *
62- * @see wp_lazyload_comment_meta()
63- *
64- * @param WP_Comment[] $comments Array of comment objects.
65- */
66-function wp_queue_comments_for_comment_meta_lazyload( $comments ) {
67-       // Don't use `wp_list_pluck()` to avoid by-reference manipulation.
68-       $comment_ids = array();
69-       if ( is_array( $comments ) ) {
70-               foreach ( $comments as $comment ) {
71-                       if ( $comment instanceof WP_Comment ) {
72-                               $comment_ids[] = $comment->comment_ID;
73-                       }
74-               }
75-       }
76-
77-       wp_lazyload_comment_meta( $comment_ids );
78-}
79diff --git tests/phpunit/tests/query/lazyLoadCommentMeta.php tests/phpunit/tests/query/lazyLoadCommentMeta.php
80index 93a8d3630f..ea41930ea3 100644
81--- tests/phpunit/tests/query/lazyLoadCommentMeta.php
82+++ tests/phpunit/tests/query/lazyLoadCommentMeta.php
83@@ -26,6 +26,7 @@ class Tests_Lazy_Load_Comment_Meta extends WP_UnitTestCase {
84         * @ticket 57901
85         *
86         * @covers ::wp_queue_comments_for_comment_meta_lazyload
87+        * @expectedDeprecated wp_queue_comments_for_comment_meta_lazyload
88         */
89        public function test_wp_queue_comments_for_comment_meta_lazyload() {
90                $filter = new MockAction();
91@@ -45,6 +46,7 @@ class Tests_Lazy_Load_Comment_Meta extends WP_UnitTestCase {
92         * @ticket 57901
93         *
94         * @covers ::wp_queue_comments_for_comment_meta_lazyload
95+        * @expectedDeprecated wp_queue_comments_for_comment_meta_lazyload
96         */
97        public function test_wp_queue_comments_for_comment_meta_lazyload_new_comment() {
98                $filter = new MockAction();