PluginProbe
ActivityPub / 7.8.2
ActivityPub v7.8.2
9.3.1 9.3.0 9.2.2 9.2.1 9.2.0 9.1.0 9.0.2 9.0.1 9.0.0 8.3.0 8.2.1 8.2.0 8.1.1 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.2.0 1.3.0 2.0.0 2.0.1 2.1.0 2.1.1 All 160 releases
← All changes | includes/class-move.php +9 -16 9.2.07.8.2 View file →
@@ -28,15 +28,15 @@
28 28 * Filter to enable automatically moving Fediverse accounts when the domain changes.
29 29 *
30 30 * @param bool $domain_moves_enabled Whether domain moves are enabled.
31 31 */
32 - $domain_moves_enabled = \apply_filters( 'activitypub_enable_primary_domain_moves', false );
32 + $domain_moves_enabled = apply_filters( 'activitypub_enable_primary_domain_moves', false );
33 33
34 34 if ( $domain_moves_enabled ) {
35 35 // Add the filter to change the domain.
36 36 \add_filter( 'update_option_home', array( self::class, 'change_domain' ), 10, 2 );
37 37
38 - if ( \get_option( 'activitypub_old_host' ) ) {
38 + if ( get_option( 'activitypub_old_host' ) ) {
39 39 \add_action( 'activitypub_construct_model_actor', array( self::class, 'maybe_initiate_old_user' ) );
40 40 \add_action( 'activitypub_pre_send_to_inboxes', array( self::class, 'pre_send_to_inboxes' ) );
41 41
42 42 if ( ! is_user_type_disabled( 'blog' ) ) {
@@ -98,10 +98,10 @@
98 98 $target_actor->from_array( $response );
99 99
100 100 // Check if the `Move` Activity is valid.
101 101 $also_known_as = $target_actor->get_also_known_as() ?? array();
102 - if ( ! \in_array( $from, $also_known_as, true ) ) {
103 - return new \WP_Error( 'invalid_target', \__( 'Invalid target', 'activitypub' ) );
102 + if ( ! in_array( $from, $also_known_as, true ) ) {
103 + return new \WP_Error( 'invalid_target', __( 'Invalid target', 'activitypub' ) );
104 104 }
105 105
106 106 $activity = new Activity();
107 107 $activity->set_type( 'Move' );
@@ -217,27 +217,20 @@
217 217 foreach ( $actors as $actor ) {
218 218 $actor_id = $actor->get_id();
219 219
220 220 // Replace the new host with the old host in the actor ID.
221 - $old_actor_id = \str_replace( $to_host, $from_host, $actor_id );
221 + $old_actor_id = str_replace( $to_host, $from_host, $actor_id );
222 222
223 223 // Call Move::internally for this actor.
224 224 $result = self::internally( $old_actor_id, $actor_id );
225 225
226 226 if ( \is_wp_error( $result ) ) {
227 - /**
228 - * Fires when an actor move fails during domain change.
229 - *
230 - * @since 8.1.0
231 - *
232 - * @param \WP_Error $result The error that occurred.
233 - * @param string $actor_id The actor ID that failed to move.
234 - */
235 - \do_action( 'activitypub_move_failed', $result, $actor_id );
227 + // Log the error and continue with the next actor.
228 + Debug::write_log( 'Error moving actor: ' . $actor_id . ' - ' . $result->get_error_message() );
236 229 continue;
237 230 }
238 231
239 - $json = \str_replace( $to_host, $from_host, $actor->to_json() );
232 + $json = str_replace( $to_host, $from_host, $actor->to_json() );
240 233
241 234 // Save the current actor data after migration.
242 235 if ( $actor instanceof Blog ) {
243 236 \update_option( 'activitypub_blog_user_old_host_data', $json, false );
@@ -283,9 +276,9 @@
283 276 *
284 277 * @param string $json The ActivityPub Activity JSON.
285 278 */
286 279 public static function pre_send_to_inboxes( $json ) {
287 - $json = \json_decode( $json, true );
280 + $json = json_decode( $json, true );
288 281
289 282 if ( 'Move' !== $json['type'] ) {
290 283 return;
291 284 }