| @@ -6,10 +6,10 @@ | ||
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | 8 | namespace Activitypub; |
| 9 | 9 | |
| 10 | +use Activitypub\Activity\Actor; | |
| 10 | 11 | use Activitypub\Activity\Activity; |
| 11 | -use Activitypub\Activity\Actor; | |
| 12 | 12 | use Activitypub\Collection\Actors; |
| 13 | 13 | use Activitypub\Model\Blog; |
| 14 | 14 | use Activitypub\Model\User; |
| 15 | 15 | |
| @@ -64,9 +64,9 @@ | ||
| 64 | 64 | |
| 65 | 65 | /** |
| 66 | 66 | * Move an ActivityPub Actor from one location (internal) to another (external). |
| 67 | 67 | * |
| 68 | - * This helps with migrating local profiles to a new external profile: | |
| 68 | + * This helps migrating local profiles to a new external profile: | |
| 69 | 69 | * |
| 70 | 70 | * `Move::externally( 'https://example.com/?author=123', 'https://mastodon.example/users/foo' );` |
| 71 | 71 | * |
| 72 | 72 | * @param string $from The current account URL. |
| @@ -118,9 +118,9 @@ | ||
| 118 | 118 | * Internal Move. |
| 119 | 119 | * |
| 120 | 120 | * Move an ActivityPub Actor from one location (internal) to another (internal). |
| 121 | 121 | * |
| 122 | - * This helps with migrating abandoned profiles to `Move` to other profiles: | |
| 122 | + * This helps migrating abandoned profiles to `Move` to other profiles: | |
| 123 | 123 | * |
| 124 | 124 | * `Move::internally( 'https://example.com/?author=123', 'https://example.com/?author=321' );` |
| 125 | 125 | * |
| 126 | 126 | * ... or to change Actor-IDs like: |
| @@ -171,8 +171,9 @@ | ||
| 171 | 171 | * @param int $user_id The user ID. |
| 172 | 172 | * @param string $from The current account URL. |
| 173 | 173 | */ |
| 174 | 174 | private static function update_user_also_known_as( $user_id, $from ) { |
| 175 | + // phpcs:ignore Universal.Operators.DisallowShortTernary.Found | |
| 175 | 176 | $also_known_as = \get_user_option( 'activitypub_also_known_as', $user_id ) ?: array(); |
| 176 | 177 | $also_known_as[] = $from; |
| 177 | 178 | |
| 178 | 179 | \update_user_option( $user_id, 'activitypub_also_known_as', $also_known_as ); |
| @@ -223,17 +224,10 @@ | ||
| 223 | 224 | // Call Move::internally for this actor. |
| 224 | 225 | $result = self::internally( $old_actor_id, $actor_id ); |
| 225 | 226 | |
| 226 | 227 | 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 ); | |
| 228 | + // Log the error and continue with the next actor. | |
| 229 | + Debug::write_log( 'Error moving actor: ' . $actor_id . ' - ' . $result->get_error_message() ); | |
| 236 | 230 | continue; |
| 237 | 231 | } |
| 238 | 232 | |
| 239 | 233 | $json = str_replace( $to_host, $from_host, $actor->to_json() ); |
| @@ -241,9 +235,9 @@ | ||
| 241 | 235 | // Save the current actor data after migration. |
| 242 | 236 | if ( $actor instanceof Blog ) { |
| 243 | 237 | \update_option( 'activitypub_blog_user_old_host_data', $json, false ); |
| 244 | 238 | } else { |
| 245 | - \update_user_option( $actor->get__id(), 'activitypub_old_host_data', $json ); | |
| 239 | + \update_user_option( $actor->get__id(), 'activitypub_old_host_data', $json, false ); | |
| 246 | 240 | } |
| 247 | 241 | |
| 248 | 242 | $results[] = array( |
| 249 | 243 | 'actor' => $actor_id, |