Query: Add more context to the split_the_query filter.
Add more context to the `split_the_query` filter by adding two new parameters: '$old_request' and '$clauses'. This enriches the filter with additional information about the SQL query before the query is run, enabling developers to have more context to help decide if a query should be split. Props spacedmonkey, shailu25, rcorrales, tillkruess. Fixes #59514. Built from https://develop.svn.wordpress.org/trunk@58180 git-svn-id: http://core.svn.wordpress.org/trunk@57643 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
73bb34454d
commit
90de126bd5
|
@ -3313,11 +3313,24 @@ class WP_Query {
|
|||
* complete row at once. One massive result vs. many small results.
|
||||
*
|
||||
* @since 3.4.0
|
||||
* @since 6.6.0 Added the `$old_request` and `$clauses` parameters.
|
||||
*
|
||||
* @param bool $split_the_query Whether or not to split the query.
|
||||
* @param WP_Query $query The WP_Query instance.
|
||||
* @param string $old_request The complete SQL query before filtering.
|
||||
* @param string[] $clauses {
|
||||
* Associative array of the clauses for the query.
|
||||
*
|
||||
* @type string $where The WHERE clause of the query.
|
||||
* @type string $groupby The GROUP BY clause of the query.
|
||||
* @type string $join The JOIN clause of the query.
|
||||
* @type string $orderby The ORDER BY clause of the query.
|
||||
* @type string $distinct The DISTINCT clause of the query.
|
||||
* @type string $fields The SELECT clause of the query.
|
||||
* @type string $limits The LIMIT clause of the query.
|
||||
* }
|
||||
*/
|
||||
$split_the_query = apply_filters( 'split_the_query', $split_the_query, $this );
|
||||
$split_the_query = apply_filters( 'split_the_query', $split_the_query, $this, $old_request, compact( $pieces ) );
|
||||
|
||||
if ( $split_the_query ) {
|
||||
// First get the IDs and then fill in the objects.
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.6-alpha-58179';
|
||||
$wp_version = '6.6-alpha-58180';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue