always use Followers::add_follower
to not ran into inconsistencies
This commit is contained in:
parent
7a360dbf6f
commit
1380025d4a
1 changed files with 1 additions and 16 deletions
|
@ -1,7 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
namespace Activitypub;
|
namespace Activitypub;
|
||||||
|
|
||||||
use Activitypub\Model\Follower;
|
|
||||||
use Activitypub\Collection\Followers;
|
use Activitypub\Collection\Followers;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -69,21 +68,7 @@ class Migration {
|
||||||
|
|
||||||
if ( $followers ) {
|
if ( $followers ) {
|
||||||
foreach ( $followers as $actor ) {
|
foreach ( $followers as $actor ) {
|
||||||
$meta = get_remote_metadata_by_actor( $actor );
|
Followers::add_follower( $user_id, $actor );
|
||||||
|
|
||||||
if ( is_tombstone( $meta ) ) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$follower = Follower::from_array( $meta );
|
|
||||||
|
|
||||||
if ( empty( $meta ) || ! is_array( $meta ) || is_wp_error( $meta ) ) {
|
|
||||||
$follower->set_error( $meta );
|
|
||||||
}
|
|
||||||
|
|
||||||
$follower->upsert();
|
|
||||||
|
|
||||||
add_post_meta( $follower->get__id(), '_user_id', $user_id );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue