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-migration.php +15 -70 8.2.07.8.2 View file →
@@ -31,10 +31,8 @@
31 31 Scheduler::register_async_batch_callback( 'activitypub_update_comment_counts', array( self::class, 'update_comment_counts' ) );
32 32 Scheduler::register_async_batch_callback( 'activitypub_create_post_outbox_items', array( self::class, 'create_post_outbox_items' ) );
33 33 Scheduler::register_async_batch_callback( 'activitypub_create_comment_outbox_items', array( self::class, 'create_comment_outbox_items' ) );
34 34 Scheduler::register_async_batch_callback( 'activitypub_migrate_avatar_to_remote_actors', array( self::class, 'migrate_avatar_to_remote_actors' ) );
35 - Scheduler::register_async_batch_callback( 'activitypub_migrate_actor_emoji', array( self::class, 'migrate_actor_emoji' ) );
36 - Scheduler::register_async_batch_callback( 'activitypub_backfill_statistics', array( Statistics::class, 'backfill_historical_stats' ) );
37 35 }
38 36
39 37 /**
40 38 * The current version of the database structure.
@@ -159,16 +157,21 @@
159 157 }
160 158 if ( \version_compare( $version_from_db, '4.7.2', '<' ) ) {
161 159 self::migrate_to_4_7_2();
162 160 }
161 + if ( \version_compare( $version_from_db, '4.7.3', '<' ) ) {
162 + add_action( 'init', 'flush_rewrite_rules', 20 );
163 + }
163 164 if ( \version_compare( $version_from_db, '5.0.0', '<' ) ) {
164 165 Scheduler::register_schedules();
165 166 \wp_schedule_single_event( \time(), 'activitypub_create_post_outbox_items' );
166 167 \wp_schedule_single_event( \time() + 15, 'activitypub_create_comment_outbox_items' );
168 + add_action( 'init', 'flush_rewrite_rules', 20 );
167 169 }
168 170 if ( \version_compare( $version_from_db, '5.4.0', '<' ) ) {
169 171 \wp_schedule_single_event( \time(), 'activitypub_upgrade', array( 'update_actor_json_slashing' ) );
170 172 \wp_schedule_single_event( \time(), 'activitypub_upgrade', array( 'update_comment_author_emails' ) );
173 + \add_action( 'init', 'flush_rewrite_rules', 20 );
171 174 }
172 175 if ( \version_compare( $version_from_db, '5.7.0', '<' ) ) {
173 176 self::delete_mastodon_api_orphaned_extra_fields();
174 177 }
@@ -174,16 +177,19 @@
174 177 }
175 178 if ( \version_compare( $version_from_db, '5.8.0', '<' ) ) {
176 179 self::update_notification_options();
177 180 }
181 +
178 182 if ( \version_compare( $version_from_db, '6.0.0', '<' ) ) {
179 183 self::migrate_followers_to_ap_actor_cpt();
180 184 \wp_schedule_single_event( \time(), 'activitypub_upgrade', array( 'update_actor_json_storage' ) );
181 185 }
186 +
182 187 if ( \version_compare( $version_from_db, '6.0.1', '<' ) ) {
183 188 self::migrate_followers_to_ap_actor_cpt();
184 189 \wp_schedule_single_event( \time(), 'activitypub_upgrade', array( 'update_actor_json_storage' ) );
185 190 }
191 +
186 192 if ( \version_compare( $version_from_db, '7.0.0', '<' ) ) {
187 193 wp_unschedule_hook( 'activitypub_update_followers' );
188 194 wp_unschedule_hook( 'activitypub_cleanup_followers' );
189 195
@@ -194,34 +200,22 @@
194 200 if ( ! \wp_next_scheduled( 'activitypub_cleanup_remote_actors' ) ) {
195 201 \wp_schedule_event( time(), 'daily', 'activitypub_cleanup_remote_actors' );
196 202 }
197 203 }
204 +
198 205 if ( \version_compare( $version_from_db, '7.3.0', '<' ) ) {
199 206 self::remove_pending_application_user_follow_requests();
200 207 }
208 +
201 209 if ( \version_compare( $version_from_db, '7.5.0', '<' ) ) {
202 210 self::sync_jetpack_following_meta();
203 211 }
212 +
204 213 if ( \version_compare( $version_from_db, '7.6.0', '<' ) ) {
205 214 self::clean_up_inbox();
206 215 \wp_schedule_single_event( \time(), 'activitypub_migrate_avatar_to_remote_actors' );
207 216 }
208 - if ( \version_compare( $version_from_db, '7.9.0', '<' ) ) {
209 - \wp_schedule_single_event( \time(), 'activitypub_migrate_actor_emoji' );
210 - }
211 - if ( \version_compare( $version_from_db, '8.1.0', '<' ) ) {
212 - // Backfill historical statistics data (delay to avoid load immediately after upgrade).
213 - \wp_schedule_single_event( \time() + HOUR_IN_SECONDS, 'activitypub_backfill_statistics' );
214 - }
215 217
216 - /*
217 - * Defer the flush to late in the `init` cycle (priority 20). Migration::init
218 - * runs at priority 1, which is earlier than most plugins register their
219 - * rewrite rules. Flushing synchronously here would persist a truncated
220 - * ruleset that omits third-party rules added on `init` at priority 10.
221 - */
222 - \add_action( 'init', array( Activitypub::class, 'flush_rewrite_rules' ), 20 );
223 -
224 218 // Ensure all required cron schedules are registered.
225 219 Scheduler::register_schedules();
226 220
227 221 /*
@@ -299,8 +293,10 @@
299 293 Followers::add( $user_id, $actor );
300 294 }
301 295 }
302 296 }
297 +
298 + Activitypub::flush_rewrite_rules();
303 299 }
304 300
305 301 /**
306 302 * Clear the cache after updating to 1.3.0.
@@ -535,9 +531,9 @@
535 531 // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_query
536 532 'meta_query' => array(
537 533 array(
538 534 'key' => 'activitypub_status',
539 - 'value' => ACTIVITYPUB_OBJECT_STATE_FEDERATED,
535 + 'value' => 'federated',
540 536 ),
541 537 ),
542 538 )
543 539 );
@@ -582,9 +578,9 @@
582 578 // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_query
583 579 'meta_query' => array(
584 580 array(
585 581 'key' => 'activitypub_status',
586 - 'value' => ACTIVITYPUB_OBJECT_STATE_FEDERATED,
582 + 'value' => 'federated',
587 583 ),
588 584 ),
589 585 )
590 586 );
@@ -1154,59 +1150,8 @@
1154 1150 // Return batch info if there are more comments to process.
1155 1151 if ( count( $comments ) === $batch_size ) {
1156 1152 return array(
1157 1153 'batch_size' => $batch_size,
1158 - );
1159 - }
1160 -
1161 - return null;
1162 - }
1163 -
1164 - /**
1165 - * Migrate emoji data from stored actor JSON to post meta.
1166 - *
1167 - * This migration:
1168 - * 1. Finds all remote actor posts without _activitypub_emoji meta
1169 - * 2. Extracts emoji from stored JSON in post_content
1170 - * 3. Stores as _activitypub_emoji post meta
1171 - *
1172 - * @param int $batch_size Optional. Number of actors to process per batch. Default 50.
1173 - * @param int $offset Optional. Offset for pagination. Default 0.
1174 - * @return array|null Array with batch size if there are more actors to process, null otherwise.
1175 - */
1176 - public static function migrate_actor_emoji( $batch_size = 50, $offset = 0 ) {
1177 - $actors = \get_posts(
1178 - array(
1179 - 'post_type' => Remote_Actors::POST_TYPE,
1180 - 'posts_per_page' => $batch_size,
1181 - 'offset' => $offset,
1182 - 'post_status' => 'any',
1183 - 'orderby' => 'ID',
1184 - 'order' => 'ASC',
1185 - )
1186 - );
1187 -
1188 - foreach ( $actors as $actor_post ) {
1189 - if ( empty( $actor_post->post_content ) ) {
1190 - continue;
1191 - }
1192 -
1193 - $actor_data = \json_decode( $actor_post->post_content, true );
1194 - if ( ! $actor_data ) {
1195 - continue;
1196 - }
1197 -
1198 - $emoji_meta = Emoji::prepare_actor_meta( $actor_data );
1199 - if ( ! empty( $emoji_meta['_activitypub_emoji'] ) ) {
1200 - \update_post_meta( $actor_post->ID, '_activitypub_emoji', $emoji_meta['_activitypub_emoji'] );
1201 - }
1202 - }
1203 -
1204 - // Return batch info if there are more actors to process.
1205 - if ( count( $actors ) === $batch_size ) {
1206 - return array(
1207 - 'batch_size' => $batch_size,
1208 - 'offset' => $offset + $batch_size,
1209 1154 );
1210 1155 }
1211 1156
1212 1157 return null;