Ticket #26937: 26937.6.patch
| File 26937.6.patch, 3.7 KB (added by , 12 years ago) |
|---|
-
wp-includes/link-template.php
1273 1273 * @return mixed Post object on success. False if no adjacent post exists. Null on failure. 1274 1274 */ 1275 1275 protected function get_post( $args ) { 1276 $this->current_post = get_post( $args['post'] );1276 $this->current_post = get_post( $args['post'] ); 1277 1277 $this->excluded_terms = array_map( 'intval', $args['excluded_terms'] ); 1278 1278 $this->adjacent = $args['previous'] ? 'previous' : 'next'; 1279 1279 $this->taxonomy = $args['taxonomy']; … … 1291 1291 1292 1292 // Build our arguments for WP_Query. 1293 1293 $query_args = array( 1294 'posts_per_page' => 1, 1295 'post_status' => 'publish', 1296 'post_type' => 'post', 1297 'orderby' => 'date', 1298 'order' => 'previous' === $this->adjacent ? 'DESC' : 'ASC', 1299 'no_found_rows' => true, 1300 'cache_results' => true, 1301 'date_query' => array(), 1294 'posts_per_page' => 1, 1295 'post_status' => 'publish', 1296 'post_type' => 'post', 1297 'orderby' => 'date', 1298 'order' => 'previous' === $this->adjacent ? 'DESC' : 'ASC', 1299 'ignore_sticky_posts' => true, 1300 'date_query' => array(), 1301 1302 // Performance considerations: 1303 'no_found_rows' => true, 1304 'cache_results' => true, 1305 'update_post_term_cache' => false, 1306 'update_post_meta_cache' => false, 1307 'split_the_query' => wp_using_ext_object_cache(), 1302 1308 ); 1303 1309 1304 1310 $tax_query = array(); … … 1398 1404 } 1399 1405 } 1400 1406 1407 /** 1408 * Posts table must be aliased as `p` for backwards compatibility with query previously generated by `get_adjacent_post()`. 1409 * No filter on the table name exists, so we have to leverage the next applied filter, that for the join clause. 1410 */ 1411 $clauses['join'] = 'AS p ' . $clauses['join']; 1412 1401 1413 /* 1402 1414 * The legacy `sort` filter combined the ORDER BY and LIMIT clauses, 1403 1415 * while `WP_Query` does not, which requires special handling. … … 1407 1419 $clauses = array_merge( $clauses, $sort_clauses ); 1408 1420 } 1409 1421 1422 /** 1423 * Posts table must be aliased as `p` for backwards compatibility with query previously generated by `get_adjacent_post()`. 1424 */ 1425 $clauses = array_map( array( $this, 'alias_posts_table' ), $clauses ); 1426 1410 1427 return $clauses; 1411 1428 } 1412 1429 … … 1470 1487 1471 1488 return compact( 'orderby', 'limits' ); 1472 1489 } 1490 1491 /** 1492 * Alias posts table as `p` to match query previously built by `get_adjacent_post()` 1493 * 1494 * @global $wpdb 1495 * @param string Clause to alias 1496 * @return string 1497 */ 1498 protected function alias_posts_table( $clause ) { 1499 global $wpdb; 1500 1501 return str_replace( $wpdb->posts, 'p', $clause ); 1502 } 1473 1503 } 1474 1504 1475 1505 /** -
wp-includes/load.php
377 377 $current_using = $_wp_using_ext_object_cache; 378 378 if ( null !== $using ) 379 379 $_wp_using_ext_object_cache = $using; 380 return $current_using;380 return (bool) $current_using; 381 381 } 382 382 383 383 /** -
wp-includes/query.php
3221 3221 } 3222 3222 3223 3223 $split_the_query = ( $old_request == $this->request && "$wpdb->posts.*" == $fields && !empty( $limits ) && $q['posts_per_page'] < 500 ); 3224 if ( $split_the_query && isset( $q['split_the_query'] ) && empty( $q['split_the_query'] ) ) { 3225 $split_the_query = false; 3226 } 3224 3227 3225 3228 /** 3226 3229 * Filter whether to split the query.