'ID' ) ) as $user_id ) { $followers = get_user_meta( $user_id, 'activitypub_followers', true ); if ( $followers ) { foreach ( $followers as $actor ) { Followers::add_follower( $user_id, $actor ); } } } Activitypub::flush_rewrite_rules(); } /** * Clear the cache after updating to 1.3.0 * * @return void */ private static function migrate_from_1_2_0() { $user_ids = \get_users( array( 'fields' => 'ID', 'capability__in' => array( 'publish_posts' ), ) ); foreach ( $user_ids as $user_id ) { wp_cache_delete( sprintf( Followers::CACHE_KEY_INBOXES, $user_id ), 'activitypub' ); } } /** * Unschedule Hooks after updating to 2.0.0 * * @return void */ private static function migrate_from_2_0_0() { wp_clear_scheduled_hook( 'activitypub_send_post_activity' ); wp_clear_scheduled_hook( 'activitypub_send_update_activity' ); wp_clear_scheduled_hook( 'activitypub_send_delete_activity' ); wp_unschedule_hook( 'activitypub_send_post_activity' ); wp_unschedule_hook( 'activitypub_send_update_activity' ); wp_unschedule_hook( 'activitypub_send_delete_activity' ); $object_type = \get_option( 'activitypub_object_type', ACTIVITYPUB_DEFAULT_OBJECT_TYPE ); if ( 'article' === $object_type ) { \update_option( 'activitypub_object_type', 'wordpress-post-format' ); } } /** * Add the ActivityPub capability to all users that can publish posts * Delete old meta to store followers * * @return void */ private static function migrate_from_2_2_0() { // add the ActivityPub capability to all users that can publish posts self::add_activitypub_capability(); } /** * Set the defaults needed for the plugin to work * * * Add the ActivityPub capability to all users that can publish posts * * @return void */ public static function add_default_settings() { self::add_activitypub_capability(); } /** * Add the ActivityPub capability to all users that can publish posts * * @return void */ private static function add_activitypub_capability() { // get all WP_User objects that can publish posts $users = \get_users( array( 'capability__in' => array( 'publish_posts' ), ) ); // add ActivityPub capability to all users that can publish posts foreach ( $users as $user ) { $user->add_cap( 'activitypub' ); } } }