Make WordPress Core


Ignore:
Timestamp:
04/20/2008 09:26:10 PM (17 years ago)
Author:
ryan
Message:

Don't include perm as part of cache key if perm is not used in the query.

File:
1 edited

Legend:

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

    r7747 r7752  
    828828
    829829    $cache_key = $type;
    830     if ( !empty($perm) )
    831         $cache_key .= '_' . $perm;
    832830
    833831    $query = "SELECT post_status, COUNT( * ) AS num_posts FROM {$wpdb->posts} WHERE post_type = %s";
    834832    if ( 'readable' == $perm && is_user_logged_in() ) {
    835833        if ( !current_user_can("read_private_{$type}s") ) {
    836             $cache_key .= '_' . $user->ID;
     834            $cache_key .= '_' . $perm . '_' . $user->ID;
    837835            $query .= " AND (post_status != 'private' OR ( post_author = '$user->ID' AND post_status = 'private' ))";
    838836        }
Note: See TracChangeset for help on using the changeset viewer.