WordPress.org

Make WordPress Core

Ticket #37464: 37464.1.diff

File 37464.1.diff, 6.1 KB (added by spacedmonkey, 5 years ago)
  • src/wp-includes/class-wp-comment-query.php

     
    393393
    394394                // $args can include anything. Only use the args defined in the query_var_defaults to compute the key.
    395395                $key = md5( serialize( wp_array_slice_assoc( $this->query_vars, array_keys( $this->query_var_defaults ) ) ) );
    396                 $last_changed = wp_cache_get( 'last_changed', 'comment' );
    397                 if ( ! $last_changed ) {
    398                         $last_changed = microtime();
    399                         wp_cache_set( 'last_changed', $last_changed, 'comment' );
    400                 }
     396                $last_changed = wp_get_last_changed( 'comment' );
    401397
     398
    402399                $cache_key   = "get_comments:$key:$last_changed";
    403400                $cache_value = wp_cache_get( $cache_key, 'comment' );
    404401                if ( false === $cache_value ) {
     
    972969                }
    973970
    974971                $key = md5( serialize( wp_array_slice_assoc( $this->query_vars, array_keys( $this->query_var_defaults ) ) ) );
    975                 $last_changed = wp_cache_get( 'last_changed', 'comment' );
    976                 if ( ! $last_changed ) {
    977                         $last_changed = microtime();
    978                         wp_cache_set( 'last_changed', $last_changed, 'comment' );
    979                 }
     972                $last_changed = wp_get_last_changed( 'comment' );
    980973
    981974                // Fetch an entire level of the descendant tree at a time.
    982975                $level = 0;
  • src/wp-includes/class-wp-network-query.php

     
    211211
    212212                // $args can include anything. Only use the args defined in the query_var_defaults to compute the key.
    213213                $key = md5( serialize( wp_array_slice_assoc( $this->query_vars, array_keys( $this->query_var_defaults ) ) ) );
    214                 $last_changed = wp_cache_get( 'last_changed', 'networks' );
    215                 if ( ! $last_changed ) {
    216                         $last_changed = microtime();
    217                         wp_cache_set( 'last_changed', $last_changed, 'networks' );
    218                 }
     214                $last_changed = wp_get_last_changed( 'networks' );
    219215
    220216                $cache_key = "get_network_ids:$key:$last_changed";
    221217                $cache_value = wp_cache_get( $cache_key, 'networks' );
  • src/wp-includes/class-wp-site-query.php

     
    247247
    248248                // $args can include anything. Only use the args defined in the query_var_defaults to compute the key.
    249249                $key = md5( serialize( wp_array_slice_assoc( $this->query_vars, array_keys( $this->query_var_defaults ) ) ) );
    250                 $last_changed = wp_cache_get( 'last_changed', 'sites' );
    251                 if ( ! $last_changed ) {
    252                         $last_changed = microtime();
    253                         wp_cache_set( 'last_changed', $last_changed, 'sites' );
    254                 }
     250                $last_changed = wp_get_last_changed( 'sites' );
    255251
    256252                $cache_key = "get_sites:$key:$last_changed";
    257253                $cache_value = wp_cache_get( $cache_key, 'sites' );
  • src/wp-includes/class-wp-term-query.php

     
    629629
    630630                // $args can be anything. Only use the args defined in defaults to compute the key.
    631631                $key = md5( serialize( wp_array_slice_assoc( $args, array_keys( $this->query_var_defaults ) ) ) . serialize( $taxonomies ) . $this->request );
    632                 $last_changed = wp_cache_get( 'last_changed', 'terms' );
    633                 if ( ! $last_changed ) {
    634                         $last_changed = microtime();
    635                         wp_cache_set( 'last_changed', $last_changed, 'terms' );
    636                 }
     632                $last_changed = wp_get_last_changed( 'terms' );
    637633                $cache_key = "get_terms:$key:$last_changed";
    638634                $cache = wp_cache_get( $cache_key, 'terms' );
    639635                if ( false !== $cache ) {
  • src/wp-includes/functions.php

     
    54635463
    54645464        return false;
    54655465}
     5466
     5467/**
     5468 *  Get last changed value from cache group
     5469 *
     5470 * @param $group
     5471 * @return string $last_changed
     5472 */
     5473function wp_get_last_changed( $group ){
     5474        $last_changed = wp_cache_get( 'last_changed', $group );
     5475        if ( ! $last_changed ) {
     5476                $last_changed = microtime();
     5477                wp_cache_set( 'last_changed', $last_changed, $group );
     5478        }
     5479        return $last_changed;
     5480}
     5481 No newline at end of file
  • src/wp-includes/general-template.php

     
    16981698
    16991699        $output = '';
    17001700
    1701         $last_changed = wp_cache_get( 'last_changed', 'posts' );
    1702         if ( ! $last_changed ) {
    1703                 $last_changed = microtime();
    1704                 wp_cache_set( 'last_changed', $last_changed, 'posts' );
    1705         }
     1701        $last_changed = wp_get_last_changed( 'posts' );
    17061702
    17071703        $limit = $r['limit'];
    17081704
  • src/wp-includes/post.php

     
    40984098function get_page_by_path( $page_path, $output = OBJECT, $post_type = 'page' ) {
    40994099        global $wpdb;
    41004100
    4101         $last_changed = wp_cache_get( 'last_changed', 'posts' );
    4102         if ( false === $last_changed ) {
    4103                 $last_changed = microtime();
    4104                 wp_cache_set( 'last_changed', $last_changed, 'posts' );
    4105         }
     4101        $last_changed = wp_get_last_changed( 'posts' );
    41064102
    41074103        $hash = md5( $page_path . serialize( $post_type ) );
    41084104        $cache_key = "get_page_by_path:$hash:$last_changed";
     
    44364432
    44374433        // $args can be whatever, only use the args defined in defaults to compute the key.
    44384434        $key = md5( serialize( wp_array_slice_assoc( $r, array_keys( $defaults ) ) ) );
    4439         $last_changed = wp_cache_get( 'last_changed', 'posts' );
    4440         if ( ! $last_changed ) {
    4441                 $last_changed = microtime();
    4442                 wp_cache_set( 'last_changed', $last_changed, 'posts' );
    4443         }
     4435        $last_changed = wp_get_last_changed( 'posts' );
    44444436
    44454437        $cache_key = "get_pages:$key:$last_changed";
    44464438        if ( $cache = wp_cache_get( $cache_key, 'posts' ) ) {