From a59408d6b8a3866820a3d6e12720cdbed969dc92 Mon Sep 17 00:00:00 2001 From: Matthias Pfefferle Date: Tue, 5 Dec 2023 13:39:00 +0100 Subject: [PATCH] clear inbox cache after update --- includes/class-migration.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/includes/class-migration.php b/includes/class-migration.php index cd13f8d..adebb7e 100644 --- a/includes/class-migration.php +++ b/includes/class-migration.php @@ -114,6 +114,9 @@ class Migration { if ( version_compare( $version_from_db, '1.0.0', '<' ) ) { self::migrate_from_0_17(); } + if ( version_compare( $version_from_db, '1.3.0', '<' ) ) { + self::migrate_from_1_2_0(); + } update_option( 'activitypub_db_version', self::get_target_version() ); @@ -176,4 +179,22 @@ class Migration { \update_option( 'activitypub_custom_post_content', $content ); } } + + /** + * 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' ); + } + } }