From ddb7e93a10ed263792000c40c36acbab2d80f1b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Till=20Kr=C3=BCss?= Date: Fri, 28 Mar 2025 13:54:51 -0700 Subject: [PATCH 1/7] unify joined `last_changed` times --- src/wp-includes/class-wp-query.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-includes/class-wp-query.php b/src/wp-includes/class-wp-query.php index 21127dc755f1c..8afe95526ed0e 100644 --- a/src/wp-includes/class-wp-query.php +++ b/src/wp-includes/class-wp-query.php @@ -2882,7 +2882,7 @@ public function get_posts() { $comments_request = "SELECT $distinct {$wpdb->comments}.comment_ID FROM {$wpdb->comments} $cjoin $cwhere $cgroupby $corderby $climits"; $key = md5( $comments_request ); - $last_changed = wp_cache_get_last_changed( 'comment' ) . ':' . wp_cache_get_last_changed( 'posts' ); + $last_changed = wp_cache_get_last_changed( 'comment' ) . '+' . wp_cache_get_last_changed( 'posts' ); $cache_key = "comment_feed:$key:$last_changed"; $comment_ids = wp_cache_get( $cache_key, 'comment-queries' ); From 27dd80393c15b65267311fce53a9a9848139c0a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Till=20Kr=C3=BCss?= Date: Fri, 28 Mar 2025 13:56:41 -0700 Subject: [PATCH 2/7] unify timestamp --- src/wp-includes/class-wp-query.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-includes/class-wp-query.php b/src/wp-includes/class-wp-query.php index 8afe95526ed0e..39bc05af801fa 100644 --- a/src/wp-includes/class-wp-query.php +++ b/src/wp-includes/class-wp-query.php @@ -5064,7 +5064,7 @@ static function ( &$value ) use ( $wpdb, $placeholder ) { $last_changed = wp_cache_get_last_changed( 'posts' ); if ( ! empty( $this->tax_query->queries ) ) { - $last_changed .= wp_cache_get_last_changed( 'terms' ); + $last_changed = wp_cache_get_last_changed( 'terms' ) . "+" . $last_changed; } $this->query_cache_key = "wp_query:$key:$last_changed"; From e35abc63c629f6607194f908602594ddeee8b0d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Till=20Kr=C3=BCss?= Date: Fri, 28 Mar 2025 13:57:23 -0700 Subject: [PATCH 3/7] single quotes --- src/wp-includes/class-wp-query.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-includes/class-wp-query.php b/src/wp-includes/class-wp-query.php index 39bc05af801fa..26bbbd61451ad 100644 --- a/src/wp-includes/class-wp-query.php +++ b/src/wp-includes/class-wp-query.php @@ -5064,7 +5064,7 @@ static function ( &$value ) use ( $wpdb, $placeholder ) { $last_changed = wp_cache_get_last_changed( 'posts' ); if ( ! empty( $this->tax_query->queries ) ) { - $last_changed = wp_cache_get_last_changed( 'terms' ) . "+" . $last_changed; + $last_changed = wp_cache_get_last_changed( 'terms' ) . '+' . $last_changed; } $this->query_cache_key = "wp_query:$key:$last_changed"; From d232563930aba926c2efad1193715e7c4603e09e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Till=20Kr=C3=BCss?= Date: Fri, 28 Mar 2025 13:58:33 -0700 Subject: [PATCH 4/7] unify --- src/wp-includes/class-wp-user-query.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-includes/class-wp-user-query.php b/src/wp-includes/class-wp-user-query.php index fd35182eab9f5..a51f05d3f79c5 100644 --- a/src/wp-includes/class-wp-user-query.php +++ b/src/wp-includes/class-wp-user-query.php @@ -1080,7 +1080,7 @@ protected function generate_cache_key( array $args, $sql ) { switch_to_blog( $blog_id ); } - $last_changed .= wp_cache_get_last_changed( 'posts' ); + $last_changed = wp_cache_get_last_changed( 'posts' ) . '+' . $last_changed; if ( $switch ) { restore_current_blog(); From 1ac6303079775fcfac9488eb594c41b39742a0ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Till=20Kr=C3=BCss?= Date: Fri, 28 Mar 2025 13:59:33 -0700 Subject: [PATCH 5/7] unify --- src/wp-includes/link-template.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-includes/link-template.php b/src/wp-includes/link-template.php index 24c713d89dbd4..7a7a4a1794dd7 100644 --- a/src/wp-includes/link-template.php +++ b/src/wp-includes/link-template.php @@ -2007,7 +2007,7 @@ function get_adjacent_post( $in_same_term = false, $excluded_terms = '', $previo $key = md5( $query ); $last_changed = wp_cache_get_last_changed( 'posts' ); if ( $in_same_term || ! empty( $excluded_terms ) ) { - $last_changed .= wp_cache_get_last_changed( 'terms' ); + $last_changed = wp_cache_get_last_changed( 'terms' ) . '+' . $last_changed; } $cache_key = "adjacent_post:$key:$last_changed"; From 56596dab9251c57e84805d74b3ba390f5ee5ed2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Till=20Kr=C3=BCss?= Date: Thu, 10 Apr 2025 08:42:05 -0700 Subject: [PATCH 6/7] use append --- src/wp-includes/class-wp-query.php | 4 ++-- src/wp-includes/class-wp-user-query.php | 2 +- src/wp-includes/link-template.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/wp-includes/class-wp-query.php b/src/wp-includes/class-wp-query.php index 26bbbd61451ad..9318933782f9e 100644 --- a/src/wp-includes/class-wp-query.php +++ b/src/wp-includes/class-wp-query.php @@ -2882,7 +2882,7 @@ public function get_posts() { $comments_request = "SELECT $distinct {$wpdb->comments}.comment_ID FROM {$wpdb->comments} $cjoin $cwhere $cgroupby $corderby $climits"; $key = md5( $comments_request ); - $last_changed = wp_cache_get_last_changed( 'comment' ) . '+' . wp_cache_get_last_changed( 'posts' ); + $last_changed = wp_cache_get_last_changed( 'posts' ) . '+' . wp_cache_get_last_changed( 'comment' ); $cache_key = "comment_feed:$key:$last_changed"; $comment_ids = wp_cache_get( $cache_key, 'comment-queries' ); @@ -5064,7 +5064,7 @@ static function ( &$value ) use ( $wpdb, $placeholder ) { $last_changed = wp_cache_get_last_changed( 'posts' ); if ( ! empty( $this->tax_query->queries ) ) { - $last_changed = wp_cache_get_last_changed( 'terms' ) . '+' . $last_changed; + $last_changed .= '+' . wp_cache_get_last_changed( 'terms' ); } $this->query_cache_key = "wp_query:$key:$last_changed"; diff --git a/src/wp-includes/class-wp-user-query.php b/src/wp-includes/class-wp-user-query.php index a51f05d3f79c5..ff7afaa400ada 100644 --- a/src/wp-includes/class-wp-user-query.php +++ b/src/wp-includes/class-wp-user-query.php @@ -1080,7 +1080,7 @@ protected function generate_cache_key( array $args, $sql ) { switch_to_blog( $blog_id ); } - $last_changed = wp_cache_get_last_changed( 'posts' ) . '+' . $last_changed; + $last_changed .= '+' . wp_cache_get_last_changed( 'posts' ); if ( $switch ) { restore_current_blog(); diff --git a/src/wp-includes/link-template.php b/src/wp-includes/link-template.php index 7a7a4a1794dd7..c7aea8d60a02b 100644 --- a/src/wp-includes/link-template.php +++ b/src/wp-includes/link-template.php @@ -2007,7 +2007,7 @@ function get_adjacent_post( $in_same_term = false, $excluded_terms = '', $previo $key = md5( $query ); $last_changed = wp_cache_get_last_changed( 'posts' ); if ( $in_same_term || ! empty( $excluded_terms ) ) { - $last_changed = wp_cache_get_last_changed( 'terms' ) . '+' . $last_changed; + $last_changed .= '+' . wp_cache_get_last_changed( 'terms' ); } $cache_key = "adjacent_post:$key:$last_changed"; From ffb11f4c64caf6b97f9f2dc8ad1f154198eef69e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Till=20Kr=C3=BCss?= Date: Thu, 10 Apr 2025 08:43:10 -0700 Subject: [PATCH 7/7] re-order --- src/wp-includes/class-wp-query.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-includes/class-wp-query.php b/src/wp-includes/class-wp-query.php index 9318933782f9e..7092d0cb7a20a 100644 --- a/src/wp-includes/class-wp-query.php +++ b/src/wp-includes/class-wp-query.php @@ -2882,7 +2882,7 @@ public function get_posts() { $comments_request = "SELECT $distinct {$wpdb->comments}.comment_ID FROM {$wpdb->comments} $cjoin $cwhere $cgroupby $corderby $climits"; $key = md5( $comments_request ); - $last_changed = wp_cache_get_last_changed( 'posts' ) . '+' . wp_cache_get_last_changed( 'comment' ); + $last_changed = wp_cache_get_last_changed( 'comment' ) . '+' . wp_cache_get_last_changed( 'posts' ); $cache_key = "comment_feed:$key:$last_changed"; $comment_ids = wp_cache_get( $cache_key, 'comment-queries' );