Pings/Trackbacks: Split `do_all_pings()` into several functions:

* `do_all_pingbacks()`
* `do_all_enclosures()`
* `do_all_trackbacks()`

This allows for the specific removal/replacement of one of more services.

Props dshanske, garrett-eclipse, Mista-Flo, azaozz, hellofromTonya.
Fixes #36576.
Built from https://develop.svn.wordpress.org/trunk@49211


git-svn-id: http://core.svn.wordpress.org/trunk@48973 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2020-10-19 21:16:02 +00:00
parent 18d3866ab2
commit 1c1aadbe54
3 changed files with 33 additions and 10 deletions

View File

@ -2800,13 +2800,23 @@ function discover_pingback_server_uri( $url, $deprecated = '' ) {
* Perform all pingbacks, enclosures, trackbacks, and send to pingback services.
*
* @since 2.1.0
*
* @global wpdb $wpdb WordPress database abstraction object.
* @since 5.6.0 Introduced `do_all_pings` action hook for individual services.
*/
function do_all_pings() {
global $wpdb;
/**
* Fires immediately after the `do_pings` event to hook services individually.
*
* @since 5.6.0
*/
do_action( 'do_all_pings' );
}
// Do pingbacks.
/**
* Perform all pingbacks.
*
* @since 5.6.0
*/
function do_all_pingbacks() {
$pings = get_posts(
array(
'post_type' => get_post_types(),
@ -2821,8 +2831,14 @@ function do_all_pings() {
delete_post_meta( $ping, '_pingme' );
pingback( null, $ping );
}
}
// Do enclosures.
/**
* Perform all enclosures.
*
* @since 5.6.0
*/
function do_all_enclosures() {
$enclosures = get_posts(
array(
'post_type' => get_post_types(),
@ -2837,8 +2853,14 @@ function do_all_pings() {
delete_post_meta( $enclosure, '_encloseme' );
do_enclose( null, $enclosure );
}
}
// Do trackbacks.
/**
* Perform all trackbacks.
*
* @since 5.6.0
*/
function do_all_trackbacks() {
$trackbacks = get_posts(
array(
'post_type' => get_post_types(),
@ -2853,9 +2875,6 @@ function do_all_pings() {
delete_post_meta( $trackback, '_trackbackme' );
do_trackbacks( $trackback );
}
// Do Update Services/Generic Pings.
generic_ping();
}
/**

View File

@ -342,6 +342,10 @@ add_action( 'do_feed_rss', 'do_feed_rss', 10, 0 );
add_action( 'do_feed_rss2', 'do_feed_rss2', 10, 1 );
add_action( 'do_feed_atom', 'do_feed_atom', 10, 1 );
add_action( 'do_pings', 'do_all_pings', 10, 0 );
add_action( 'do_all_pings', 'do_all_pingbacks', 10, 0 );
add_action( 'do_all_pings', 'do_all_enclosures', 10, 0 );
add_action( 'do_all_pings', 'do_all_trackbacks', 10, 0 );
add_action( 'do_all_pings', 'generic_ping', 10, 0 );
add_action( 'do_robots', 'do_robots' );
add_action( 'do_favicon', 'do_favicon' );
add_action( 'set_comment_cookies', 'wp_set_comment_cookies', 10, 3 );

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.6-alpha-49210';
$wp_version = '5.6-alpha-49211';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.