Make WordPress Core

Ticket #36792: 36792.patch

File 36792.patch, 1022 bytes (added by spacedmonkey, 9 years ago)
  • src/wp-includes/query.php

     
    36033603                         * @param WP_Query $this    The WP_Query instance.
    36043604                         */
    36053605                        $this->request = apply_filters( 'posts_request_ids', $this->request, $this );
     3606                       
     3607                        if ( $q['cache_results'] ) {
     3608                                $key = md5( $this->request );
     3609                                $last_changed = wp_cache_get( 'last_changed', 'posts' );
     3610                                if ( ! $last_changed ) {
     3611                                        $last_changed = microtime();
     3612                                        wp_cache_set( 'last_changed', $last_changed, 'posts' );
     3613                                }
     3614                                $cache_key = "get_post_ids:$key:$last_changed";
     3615                                $ids = wp_cache_get( $cache_key, 'posts' );
     3616                                if ( false === $ids ) {
     3617                                        $ids = $wpdb->get_col( $this->request );
     3618                                        wp_cache_add( $cache_key, $ids, 'posts' );
     3619                                }
     3620                        } else {
     3621                                $ids = $wpdb->get_col( $this->request );
     3622                        }
    36063623
    3607                         $ids = $wpdb->get_col( $this->request );
    36083624
    36093625                        if ( $ids ) {
    36103626                                $this->posts = $ids;