Skip to content

Commit 525549c

Browse files
committed
Switch from using the ping list in the post to a separate list that only saves from webmention to webmention what is going on.
1 parent 2e295de commit 525549c

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

includes/class-sender.php

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -208,14 +208,15 @@ public static function send_webmentions( $post_id ) {
208208
$urls = webmention_extract_urls( $post->post_content, $support_media_urls );
209209

210210
// filter links
211-
$targets = apply_filters( 'webmention_links', $urls, $post_id );
212-
$targets = array_unique( $targets );
213-
$pung = get_pung( $post );
211+
$targets = apply_filters( 'webmention_links', $urls, $post_id );
212+
$targets = array_unique( $targets );
213+
$mentioned = get_post_meta( $post->ID, 'webmention_last_mentioned_urls', true );
214+
$mentioned = empty( $mentioned ) ? array() : $mentioned;
214215

215216
// Find previously sent Webmentions and send them one last time.
216-
$deletes = array_diff( $pung, $targets );
217+
$deletes = array_diff( $mentioned, $targets );
217218

218-
$ping = array();
219+
$mentions = array();
219220

220221
foreach ( $targets as $target ) {
221222
// send Webmention
@@ -230,7 +231,7 @@ public static function send_webmentions( $post_id ) {
230231
! is_wp_error( $response ) &&
231232
wp_remote_retrieve_response_code( $response ) < 400
232233
) {
233-
$ping[] = $target;
234+
$mentions[] = $target;
234235
}
235236

236237
// reschedule if server responds with a http error 5xx
@@ -246,15 +247,15 @@ public static function send_webmentions( $post_id ) {
246247
// reschedule if server responds with a http error 5xx
247248
if ( wp_remote_retrieve_response_code( $response ) >= 500 ) {
248249
self::reschedule( $post_id );
249-
$ping[] = $deleted;
250+
$mentions[] = $deleted;
250251
}
251252
}
252253

253-
if ( ! empty( $ping ) ) {
254-
self::update_ping( $post, $ping );
254+
if ( ! empty( $mentions ) ) {
255+
update_post_meta( $post_id, 'webmention_last_mentioned_urls', $mentions );
255256
}
256257

257-
return $ping;
258+
return $mentions;
258259
}
259260

260261
/*

0 commit comments

Comments
 (0)