Make WordPress Core


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

Fix 'timeinfo' cache invalidation. Fixes #14922

File:
1 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
Note: See TracChangeset for help on using the changeset viewer.