Skip to content

Commit c3da954

Browse files
committed
Restore update punged
1 parent 1b24c81 commit c3da954

File tree

3 files changed

+28
-2
lines changed

3 files changed

+28
-2
lines changed

includes/class-avatar-store.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ public static function store_avatar( $comment_id ) {
185185
if ( empty( $author ) ) {
186186
return false;
187187
}
188-
$host = webmention_extract_domain( get_url_from_webmention( $comment ) );
188+
$host = webmention_extract_domain( get_url_from_webmention( $comment ) );
189189
$avatar_url = self::sideload_avatar( $avatar, $host, $author );
190190

191191
if ( $avatar_url ) {

includes/class-sender.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,9 +252,34 @@ public static function send_webmentions( $post_id ) {
252252
update_post_meta( $post_id, 'webmention_last_mentioned_urls', $mentions );
253253
}
254254

255+
$pung = get_pung( $post );
256+
257+
if ( ! empty( $ping ) ) {
258+
self::update_ping( $post, array_merge( $pung, $ping ) );
259+
}
260+
255261
return $mentions;
256262
}
257263

264+
public static function update_ping( $post_id, $pinged ) {
265+
global $wpdb;
266+
$post = get_post( $post_id );
267+
if ( ! $post ) {
268+
return false;
269+
}
270+
271+
if ( ! is_array( $pinged ) ) {
272+
return false;
273+
}
274+
275+
$new = implode( "\n", $pinged );
276+
277+
$wpdb->update( $wpdb->posts, array( 'pinged' => $new ), array( 'ID' => $post->ID ) );
278+
clean_post_cache( $post->ID );
279+
280+
return $new;
281+
}
282+
258283
/**
259284
* Reschedule Webmentions on HTTP code 500
260285
*

includes/functions.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,8 +550,9 @@ function ifset( &$var, $return = false ) { // phpcs:ignore Universal.NamingConve
550550
* @return boolean if webmentions are open
551551
*/
552552
function webmentions_open( $post = null ) {
553-
$post = get_post( $post );
553+
$post = get_post( $post );
554554
$post_id = $post ? $post->ID : 0;
555+
$open = false;
555556
if ( $post ) {
556557
// Always consider the home mention link page to be open.
557558
if ( get_option( 'webmention_home_mentions' ) === $post->ID ) {

0 commit comments

Comments
 (0)