Ticket #18356: 18356.3.diff
File 18356.3.diff, 1.7 KB (added by , 10 years ago) |
---|
-
src/wp-includes/bookmark.php
118 118 global $wpdb; 119 119 120 120 $defaults = array( 121 'orderby' => 'name', 'order' => 'ASC', 122 'limit' => -1, 'category' => '', 123 'category_name' => '', 'hide_invisible' => 1, 124 'show_updated' => 0, 'include' => '', 125 'exclude' => '', 'search' => '' 121 'orderby' => 'name', 122 'order' => 'ASC', 123 'limit' => -1, 124 'category' => '', 125 'category_name' => '', 126 'hide_invisible' => 1, 127 'show_updated' => 0, 128 'include' => '', 129 'exclude' => '', 130 'search' => '', 131 'expire' => 60 126 132 ); 127 133 128 134 $r = wp_parse_args( $args, $defaults ); 129 135 130 136 $key = md5( serialize( $r ) ); 131 if ( $cache = wp_cache_get( 'get_bookmarks', 'bookmark' ) ) { 137 if ( 'rand' == $orderby ) { 138 if ( $results = wp_cache_get( $key, 'get_bookmarks_rand' ) ) { 139 return apply_filters( 'get_bookmarks', $results, $r ); 140 } 141 } elseif ( $cache = wp_cache_get( 'get_bookmarks', 'bookmark' ) ) { 132 142 if ( is_array( $cache ) && isset( $cache[ $key ] ) ) { 133 143 $bookmarks = $cache[ $key ]; 134 144 /** … … 285 295 286 296 $results = $wpdb->get_results( $query ); 287 297 288 $cache[ $key ] = $results; 289 wp_cache_set( 'get_bookmarks', $cache, 'bookmark' ); 298 if ( 'rand()' == $orderby ) { 299 wp_cache_set( $key, $results, 'get_bookmarks_rand', $expire ); 300 } else { 301 $cache[$key] = $results; 302 wp_cache_set( 'get_bookmarks', $cache, 'bookmark' ); 303 } 290 304 291 305 /** This filter is documented in wp-includes/bookmark.php */ 292 306 return apply_filters( 'get_bookmarks', $results, $r );