fix removal of event sources
Some checks failed
PHP Code Checker / PHP Code Checker (pull_request) Failing after 48s
PHPUnit / PHPUnit – PHP 7.4 (pull_request) Failing after 56s
PHPUnit / PHPUnit – PHP 8.0 (pull_request) Successful in 1m7s
PHPUnit / PHPUnit – PHP 8.1 (pull_request) Successful in 1m4s
PHPUnit / PHPUnit – PHP 8.2 (pull_request) Successful in 1m2s
PHPUnit / PHPUnit – PHP 8.3 (pull_request) Successful in 1m5s
PHPUnit / PHPUnit – PHP 8.4 (pull_request) Successful in 1m3s
Some checks failed
PHP Code Checker / PHP Code Checker (pull_request) Failing after 48s
PHPUnit / PHPUnit – PHP 7.4 (pull_request) Failing after 56s
PHPUnit / PHPUnit – PHP 8.0 (pull_request) Successful in 1m7s
PHPUnit / PHPUnit – PHP 8.1 (pull_request) Successful in 1m4s
PHPUnit / PHPUnit – PHP 8.2 (pull_request) Successful in 1m2s
PHPUnit / PHPUnit – PHP 8.3 (pull_request) Successful in 1m5s
PHPUnit / PHPUnit – PHP 8.4 (pull_request) Successful in 1m3s
This commit is contained in:
parent
178beb7dd5
commit
37043e7a7b
2 changed files with 16 additions and 17 deletions
|
@ -178,12 +178,23 @@ class Event_Sources {
|
||||||
*
|
*
|
||||||
* @param string $actor The Actor URL.
|
* @param string $actor The Actor URL.
|
||||||
*
|
*
|
||||||
* @return bool True on success, false on failure.
|
* @return WP_Post|false|null Post data on success, false or null on failure.
|
||||||
*/
|
*/
|
||||||
public static function remove_event_source( $actor ) {
|
public static function remove_event_source( $actor ) {
|
||||||
$actor = true;
|
$post_id = Event_Source::get_wp_post_from_activitypub_actor_id( $actor );
|
||||||
|
|
||||||
|
if ( ! $post_id ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = wp_delete_post( $post_id, true );
|
||||||
|
|
||||||
|
// If the deletion was successful delete all transients regarding event sources.
|
||||||
|
if ( $result ) {
|
||||||
self::delete_event_source_transients();
|
self::delete_event_source_transients();
|
||||||
return $actor;
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -292,18 +303,6 @@ class Event_Sources {
|
||||||
return $event_sources;
|
return $event_sources;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove a Follower.
|
|
||||||
*
|
|
||||||
* @param string $event_source The Actor URL.
|
|
||||||
*
|
|
||||||
* @return mixed True on success, false on failure.
|
|
||||||
*/
|
|
||||||
public static function remove( $event_source ) {
|
|
||||||
$post_id = Event_Source::get_wp_post_from_activitypub_actor_id( $event_source );
|
|
||||||
return wp_delete_post( $post_id, true );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Queue a hook to run async.
|
* Queue a hook to run async.
|
||||||
*
|
*
|
||||||
|
|
|
@ -228,7 +228,7 @@ class Event_Sources extends WP_List_Table {
|
||||||
$event_sources = array( $event_sources );
|
$event_sources = array( $event_sources );
|
||||||
}
|
}
|
||||||
foreach ( $event_sources as $event_source ) {
|
foreach ( $event_sources as $event_source ) {
|
||||||
Event_Sources_Collection::remove( $event_source );
|
Event_Sources_Collection::remove_event_source( $event_source );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue