Skip to content

Commit

Permalink
cs fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
kt-12 committed Nov 13, 2023
1 parent 0d2a0d5 commit 22357e2
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/wp-includes/class-wp-query.php
Original file line number Diff line number Diff line change
Expand Up @@ -1895,14 +1895,14 @@ public function get_posts() {
}

$q['cache_early'] = $q['cache_results'] && $q['cache_early'];
if( $q['cache_early'] ) {
$q = $this->get_get_posts_filter_pattern( $q );
$early_hash = md5( serialize( $q ) );
$last_changed = wp_cache_get_last_changed( 'posts' );
if ( $q['cache_early'] ) {
$q = $this->get_get_posts_filter_pattern( $q );
$early_hash = md5( serialize( $q ) );
$last_changed = wp_cache_get_last_changed( 'posts' );
$early_cache_key = "get_posts:$early_hash:$last_changed";
$cache_key = wp_cache_get( $early_cache_key, 'post-cache-keys', true );
$cache_found = false;
if ( !empty( $cache_key ) && null === $this->posts ) {
$cache_key = wp_cache_get( $early_cache_key, 'post-cache-keys', true );
$cache_found = false;
if ( ! empty( $cache_key ) && null === $this->posts ) {
$cached_results = wp_cache_get( $cache_key, 'post-queries', false, $cache_found );

if ( $cached_results ) {
Expand Down Expand Up @@ -3228,7 +3228,7 @@ public function get_posts() {
if ( $q['cache_results'] && $id_query_is_cacheable ) {
$new_request = str_replace( $fields, "{$wpdb->posts}.*", $this->request );
$cache_key = $this->generate_cache_key( $q, $new_request );
if( $q['cache_early'] ) {
if ( $q['cache_early'] ) {
wp_cache_add( $early_cache_key, $cache_key, 'posts-cache-keys' );
}

Expand Down Expand Up @@ -3628,11 +3628,11 @@ public function get_posts() {

/**
* Capture signature of filter from get_posts in $args.
*
*
* @param array $args query args.
* @return array $args
*/
public function get_get_posts_filter_pattern( $args ){
public function get_get_posts_filter_pattern( $args ) {
global $wp_filter;
$filters = array(
'wp_allow_query_attachment_by_filename',
Expand Down Expand Up @@ -3670,8 +3670,8 @@ public function get_get_posts_filter_pattern( $args ){
'the_posts',
);

foreach( $filters as $filter ){
if( has_filter( $filter ) ){
foreach ( $filters as $filter ) {
if ( has_filter( $filter ) ) {
$args['args_filters'][ $filter ] = $wp_filter[ $filter ];
}
}
Expand Down

0 comments on commit 22357e2

Please sign in to comment.