Skip to content

Commit

Permalink
Remove ping usage from sender
Browse files Browse the repository at this point in the history
  • Loading branch information
dshanske committed Jul 22, 2024
1 parent 525549c commit cff074e
Showing 1 changed file with 5 additions and 33 deletions.
38 changes: 5 additions & 33 deletions includes/class-sender.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,16 +226,13 @@ public static function send_webmentions( $post_id ) {
continue;
}

$code = wp_remote_retrieve_response_code( $response );

// check response
if (
! is_wp_error( $response ) &&
wp_remote_retrieve_response_code( $response ) < 400
) {
if ( ! is_wp_error( $response ) && $code < 400 ) {
$mentions[] = $target;
}

// reschedule if server responds with a http error 5xx
if ( wp_remote_retrieve_response_code( $response ) >= 500 ) {
} elseif ( $code >= 500 ) {
// reschedule if server responds with a http error 5xx
self::reschedule( $post_id );
}
}
Expand All @@ -258,31 +255,6 @@ public static function send_webmentions( $post_id ) {
return $mentions;
}

/*
* Update the Pinged List as Opposed to Adding to It.
*
* @param int|WP_Post $post_id Post.
* @param array $pinged Array of URLs
*/
public static function update_ping( $post_id, $pinged ) {
global $wpdb;
$post = get_post( $post_id );
if ( ! $post ) {
return false;
}

if ( ! is_array( $pinged ) ) {
return false;
}

$new = implode( "\n", $pinged );

$wpdb->update( $wpdb->posts, array( 'pinged' => $new ), array( 'ID' => $post->ID ) );
clean_post_cache( $post->ID );

return $new;
}

/**
* Reschedule Webmentions on HTTP code 500
*
Expand Down

0 comments on commit cff074e

Please sign in to comment.