Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Peter Wilson <[email protected]>
  • Loading branch information
jonnynews and peterwilsoncc authored May 3, 2024
1 parent 354472d commit 8d848b0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 11 additions & 1 deletion src/wp-includes/class-wp-query.php
Original file line number Diff line number Diff line change
Expand Up @@ -3109,7 +3109,17 @@ public function get_posts() {
$found_rows = 'SQL_CALC_FOUND_ROWS';
}

// Beginning of the string is on a new line to prevent leading whitespace. See https://core.trac.wordpress.org/ticket/56841.
/*
* Beginning of the string is on a new line to prevent leading whitespace.

Check failure on line 3113 in src/wp-includes/class-wp-query.php

View workflow job for this annotation

GitHub Actions / PHP coding standards

Whitespace found at end of line

Check failure on line 3113 in src/wp-includes/class-wp-query.php

View workflow job for this annotation

GitHub Actions / PHP coding standards

Whitespace found at end of line
*
* The additional indentation of subsequent lines is to ensure the SQL
* queries are identical to those generated when splitting queries. This
* improves caching of the query by ensuring the same cache key is

Check failure on line 3117 in src/wp-includes/class-wp-query.php

View workflow job for this annotation

GitHub Actions / PHP coding standards

Whitespace found at end of line

Check failure on line 3117 in src/wp-includes/class-wp-query.php

View workflow job for this annotation

GitHub Actions / PHP coding standards

Whitespace found at end of line
* generated for the same database queries functionally.
*
* See https://core.trac.wordpress.org/ticket/56841.
* See https://github.com/WordPress/wordpress-develop/pull/6393#issuecomment-2088217429
*/
$old_request =
"SELECT $found_rows $distinct $fields
FROM {$wpdb->posts} $join
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/tests/query/cacheResults.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ public function test_generate_cache_key_unregister_post_type() {
unregister_post_type( 'wptests_pt' );
$cache_key_2 = $reflection->invoke( $query1, $query_vars, $request1 );

$this->assertNotSame( $cache_key_1, $cache_key_2, 'Cache key should differs when after unregister post type.' );
$this->assertNotSame( $cache_key_1, $cache_key_2, 'Cache key should differ after unregistering post type.' );
}

/**
Expand Down

0 comments on commit 8d848b0

Please sign in to comment.