| @@ -61,10 +61,10 @@ | ||
| 61 | 61 | global $wpdb; |
| 62 | 62 | // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery |
| 63 | 63 | $wpdb->update( |
| 64 | 64 | $wpdb->posts, |
| 65 | - array( 'guid' => sanitize_url( $target_uri ) ), | |
| 66 | - array( 'ID' => sanitize_key( $origin_object->ID ) ) | |
| 65 | + array( 'guid' => \sanitize_url( $target_uri ) ), | |
| 66 | + array( 'ID' => \sanitize_key( $origin_object->ID ) ) | |
| 67 | 67 | ); |
| 68 | 68 | |
| 69 | 69 | // Clear the cache. |
| 70 | 70 | \wp_cache_delete( $origin_object->ID, 'posts' ); |
| @@ -69,9 +69,11 @@ | ||
| 69 | 69 | // Clear the cache. |
| 70 | 70 | \wp_cache_delete( $origin_object->ID, 'posts' ); |
| 71 | 71 | |
| 72 | 72 | $success = true; |
| 73 | - $result = Remote_Actors::upsert( $target_json ); | |
| 73 | + | |
| 74 | + // get_remote_object() already self-confirmed the target, so it is safe to cache. | |
| 75 | + $result = Remote_Actors::upsert( $target_json ); | |
| 74 | 76 | } |
| 75 | 77 | |
| 76 | 78 | // If both the target and origin are followed, merge them. |
| 77 | 79 | if ( ! \is_wp_error( $target_object ) && ! \is_wp_error( $origin_object ) ) { |
| @@ -176,9 +178,9 @@ | ||
| 176 | 178 | return false; |
| 177 | 179 | } |
| 178 | 180 | |
| 179 | 181 | // Collect all possible origin identifiers (id, url, webfinger). |
| 180 | - $origin_ids = array_filter( | |
| 182 | + $origin_ids = \array_filter( | |
| 181 | 183 | array( |
| 182 | 184 | $origin_object['id'] ?? null, |
| 183 | 185 | $origin_object['url'] ?? null, |
| 184 | 186 | $origin_object['webfinger'] ?? null, |
| @@ -185,9 +187,9 @@ | ||
| 185 | 187 | ) |
| 186 | 188 | ); |
| 187 | 189 | |
| 188 | 190 | // Check if any origin identifier is in the alsoKnownAs property of the target. |
| 189 | - if ( ! array_intersect( $origin_ids, $also_known_as ) ) { | |
| 191 | + if ( ! \array_intersect( $origin_ids, $also_known_as ) ) { | |
| 190 | 192 | return false; |
| 191 | 193 | } |
| 192 | 194 | |
| 193 | 195 | // Check if the origin has a movedTo property. |