Ticket #36824: 36824.4.diff
File 36824.4.diff, 4.4 KB (added by , 9 years ago) |
---|
-
src/wp-includes/comment.php
2266 2266 function do_all_pings() { 2267 2267 global $wpdb; 2268 2268 2269 $post_types = get_post_types( array( 'publicly_queryable' => true ) ); 2270 2269 2271 // Do pingbacks 2270 while ($ping = $wpdb->get_row("SELECT ID, post_content, meta_id FROM {$wpdb->posts}, {$wpdb->postmeta} WHERE {$wpdb->posts}.ID = {$wpdb->postmeta}.post_id AND {$wpdb->postmeta}.meta_key = '_pingme' LIMIT 1")) { 2271 delete_metadata_by_mid( 'post', $ping->meta_id ); 2272 $pings = get_posts( array( 'post_type' => $post_types, 'suppress_filters' => false, 'posts_per_page' => -1, 'meta_value' => '_pingme' ) ); 2273 foreach ( $pings as $ping ) { 2274 delete_post_meta( $ping->ID, '_pingme' ); 2272 2275 pingback( $ping->post_content, $ping->ID ); 2273 2276 } 2274 2277 2275 2278 // Do Enclosures 2276 while ($enclosure = $wpdb->get_row("SELECT ID, post_content, meta_id FROM {$wpdb->posts}, {$wpdb->postmeta} WHERE {$wpdb->posts}.ID = {$wpdb->postmeta}.post_id AND {$wpdb->postmeta}.meta_key = '_encloseme' LIMIT 1")) { 2277 delete_metadata_by_mid( 'post', $enclosure->meta_id ); 2279 $enclosures = get_posts( array( 'post_type' => $post_types, 'suppress_filters' => false, 'posts_per_page' => -1, 'meta_value' => '_encloseme' ) ); 2280 foreach ( $enclosures as $enclosure ) { 2281 delete_post_meta( $enclosure->ID, '_encloseme' ); 2278 2282 do_enclose( $enclosure->post_content, $enclosure->ID ); 2279 2283 } 2280 2284 2281 2285 // Do Trackbacks 2282 $trackbacks = $wpdb->get_col("SELECT ID FROM $wpdb->posts WHERE to_ping <> '' AND post_status = 'publish'");2283 if ( is_array($trackbacks) )2284 foreach ( $trackbacks as $trackback )2285 do_trackbacks($trackback);2286 $trackbacks = get_posts( array( 'post_type' => $post_types, 'suppress_filters' => false, 'posts_per_page' => -1, 'to_ping' => true, 'fields' => 'ids' ) ); 2287 foreach ( $trackbacks as $trackback ) { 2288 do_trackbacks( $trackback ); 2289 } 2286 2290 2287 2291 //Do Update Services/Generic Pings 2288 2292 generic_ping(); -
src/wp-includes/query.php
1577 1577 * @type array $tax_query An associative array of WP_Tax_Query arguments. 1578 1578 * See WP_Tax_Query->queries. 1579 1579 * @type string $title Post title. 1580 * @type string $to_ping Post ping status. Default false. 1580 1581 * @type bool $update_post_meta_cache Whether to update the post meta cache. Default true. 1581 1582 * @type bool $update_post_term_cache Whether to update the post term cache. Default true. 1582 1583 * @type bool $lazy_load_term_meta Whether to lazy-load term meta. Setting to false will … … 1621 1622 $qv['pagename'] = trim( $qv['pagename'] ); 1622 1623 $qv['name'] = trim( $qv['name'] ); 1623 1624 $qv['title'] = trim( $qv['title'] ); 1625 1624 1626 if ( '' !== $qv['hour'] ) $qv['hour'] = absint($qv['hour']); 1625 1627 if ( '' !== $qv['minute'] ) $qv['minute'] = absint($qv['minute']); 1626 1628 if ( '' !== $qv['second'] ) $qv['second'] = absint($qv['second']); … … 2565 2567 else 2566 2568 $q['post_type'] = ''; 2567 2569 } 2570 if ( ! isset( $q['to_ping'] ) ) { 2571 $q['to_ping'] = false; 2572 } 2568 2573 $post_type = $q['post_type']; 2569 2574 if ( empty( $q['posts_per_page'] ) ) { 2570 2575 $q['posts_per_page'] = get_option( 'posts_per_page' ); … … 3093 3098 $post_type_object = get_post_type_object ( 'post' ); 3094 3099 } 3095 3100 3101 if ( $q['to_ping'] ) { 3102 $where .= " AND {$wpdb->posts}.to_ping <> ''"; 3103 } 3104 3096 3105 $edit_cap = 'edit_post'; 3097 3106 $read_cap = 'read_post'; 3098 3107 -
tests/phpunit/tests/post/query.php
388 388 $actual_posts = $q->get_posts(); 389 389 $this->assertEqualSets( $requested, $actual_posts ); 390 390 } 391 392 /** 393 * Tests the to_ping attribute of WP_Query. 394 * 395 * @ticket 36824 396 */ 397 public function test_to_ping() { 398 $q = new WP_Query(); 391 399 400 $post_ids[0] = self::factory()->post->create( array( 401 'to_ping' => 'http://www.example.com' ) ); 402 $q->query( array( 403 'to_ping' => '', 404 'fields' => 'ids' ) ); 405 $actual_posts = $q->get_posts(); 406 $this->assertSame( $post_ids, $actual_posts ); 407 } 408 409 392 410 /** 393 411 * @ticket 36687 394 412 */