Make WordPress Core

Ticket #23167: 23167.2.diff

File 23167.2.diff, 1.4 KB (added by ryan, 12 years ago)

For post.php and comment.php

  • wp-includes/post.php

     
    36523652        // $args can be whatever, only use the args defined in defaults to compute the key
    36533653        $key = md5( serialize( compact(array_keys($defaults)) ) );
    36543654        $last_changed = wp_cache_get( 'last_changed', 'posts' );
    3655         if ( ! $last_changed )
    3656                 $last_changed = wp_cache_set( 'last_changed', 1, 'posts' );
     3655        if ( ! $last_changed ) {
     3656                wp_cache_set( 'last_changed', 1, 'posts' );
     3657                $last_changed = 1;
     3658        }
    36573659
    36583660        $cache_key = "get_pages:$key:$last_changed";
    36593661        if ( $cache = wp_cache_get( $cache_key, 'posts' ) ) {
  • wp-includes/comment.php

     
    250250                // $args can be whatever, only use the args defined in defaults to compute the key
    251251                $key = md5( serialize( compact(array_keys($defaults)) )  );
    252252                $last_changed = wp_cache_get( 'last_changed', 'comment' );
    253                 if ( ! $last_changed )
    254                         $last_changed = wp_cache_set( 'last_changed', 1, 'comment' );
     253                if ( ! $last_changed ) {
     254                        wp_cache_set( 'last_changed', 1, 'comment' );
     255                        $last_changed = 1;
     256                }
    255257                $cache_key = "get_comments:$key:$last_changed";
    256258
    257259                if ( $cache = wp_cache_get( $cache_key, 'comment' ) )