WordPress.org

Make WordPress Core

Changeset 16537


Ignore:
Timestamp:
11/22/2010 09:45:45 PM (8 years ago)
Author:
scribu
Message:

Fix 'timeinfo' cache invalidation. Fixes #14922

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/post.php

    r16535 r16537  
    41724172        return false;
    41734173
    4174     $post_types = get_query_var('post_type');
    4175     if ( empty($post_types) )
    4176         $post_types = 'post';
    4177 
    4178     $post_types = apply_filters( "get_lastpost{$field}_post_types", (array) $post_types );
    4179 
    4180     $key = "lastpost{$field}:" . get_current_blog_id() . ":$timezone:" . md5( serialize( $post_types ) );
     4174    $timezone = strtolower( $timezone );
     4175
     4176    $key = "lastpost{$field}:$timezone";
    41814177
    41824178    $date = wp_cache_get( $key, 'timeinfo' );
     
    41854181        $add_seconds_server = date('Z');
    41864182
     4183        $post_types = get_post_types( array( 'publicly_queryable' => true ) );
    41874184        array_walk( $post_types, array( &$wpdb, 'escape_by_ref' ) );
    41884185        $post_types = "'" . implode( "', '", $post_types ) . "'";
    41894186
    4190         switch ( strtolower( $timezone ) ) {
     4187        switch ( $timezone ) {
    41914188            case 'gmt':
    41924189                $date = $wpdb->get_var("SELECT post_{$field}_gmt FROM $wpdb->posts WHERE post_status = 'publish' AND post_type IN ({$post_types}) ORDER BY post_{$field}_gmt DESC LIMIT 1");
     
    44514448    // If published posts changed clear the lastpostmodified cache
    44524449    if ( 'publish' == $new_status || 'publish' == $old_status) {
    4453         wp_cache_delete( 'lastpostmodified:server', 'timeinfo' );
    4454         wp_cache_delete( 'lastpostmodified:gmt',    'timeinfo' );
    4455         wp_cache_delete( 'lastpostmodified:blog',   'timeinfo' );
     4450        foreach ( array( 'server', 'gmt', 'blog' ) as $timezone ) {
     4451            wp_cache_delete( "lastpostmodified:$timezone", 'timeinfo' );
     4452            wp_cache_delete( "lastpostdate:$timezone", 'timeinfo' );
     4453        }
    44564454    }
    44574455
  • trunk/wp-settings.php

    r16424 r16537  
    3636
    3737// Ensure these global variables do not exist so they do not interfere with WordPress.
    38 unset( $wp_filter, $cache_lastcommentmodified, $cache_lastpostdate );
     38unset( $wp_filter, $cache_lastcommentmodified );
    3939
    4040// Standardize $_SERVER variables across setups.
Note: See TracChangeset for help on using the changeset viewer.