Make WordPress Core

Ticket #18356: 18356.refresh.patch

File 18356.refresh.patch, 1.3 KB (added by c3mdigital, 11 years ago)

refresh of 2nd patch

  • wp-includes/bookmark.php

     
    126126                'limit' => -1, 'category' => '',
    127127                'category_name' => '', 'hide_invisible' => 1,
    128128                'show_updated' => 0, 'include' => '',
    129                 'exclude' => '', 'search' => ''
     129                'exclude' => '', 'search' => '',
     130                'expire' => 60
    130131        );
    131132
    132133        $r = wp_parse_args( $args, $defaults );
     
    134135
    135136        $cache = array();
    136137        $key = md5( serialize( $r ) );
    137         if ( $cache = wp_cache_get( 'get_bookmarks', 'bookmark' ) ) {
     138        if ( 'rand' == $orderby ) {
     139                if ( $results = wp_cache_get( $key, 'get_bookmarks_rand' ) )
     140                        return apply_filters( 'get_bookmarks', $results, $r );
     141        } elseif ( $cache = wp_cache_get( 'get_bookmarks', 'bookmark' ) ) {
    138142                if ( is_array($cache) && isset( $cache[ $key ] ) )
    139143                        return apply_filters('get_bookmarks', $cache[ $key ], $r );
    140144        }
     
    260264
    261265        $results = $wpdb->get_results($query);
    262266
    263         $cache[ $key ] = $results;
    264         wp_cache_set( 'get_bookmarks', $cache, 'bookmark' );
     267        if ( 'rand()' == $orderby ) {
     268                wp_cache_set( $key, $results, 'get_bookmarks_rand', $expire );
     269        } else {
     270                $cache[$key] = $results;
     271                wp_cache_set( 'get_bookmarks', $cache, 'bookmark' );
     272        }
    265273
    266274        return apply_filters('get_bookmarks', $results, $r);
    267275}