Skip to content

Commit

Permalink
Revert "Add upgrade routine."
Browse files Browse the repository at this point in the history
This reverts commit 11276f9.
  • Loading branch information
pls78 committed Oct 25, 2023
1 parent 11276f9 commit 21550f4
Showing 1 changed file with 0 additions and 41 deletions.
41 changes: 0 additions & 41 deletions inc/class-upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ public function __construct() {
'20.5-RC0' => 'upgrade_205',
'20.7-RC0' => 'upgrade_207',
'20.8-RC0' => 'upgrade_208',
'21.6-rc0' => 'upgrade_216'
];

array_walk( $routines, [ $this, 'run_upgrade_routine' ], $version );
Expand Down Expand Up @@ -1014,46 +1013,6 @@ private function upgrade_208() {
}
}

/**
* Performs the 21.6 upgrade routine.
* Avoid storing the full WP_User object in each notification and saves just the user id instead.
*/
private function upgrade_216() {
add_action( 'init', [ $this, 'update_notifications_user_id_for_216' ] );
}

protected function update_notifications_user_id_for_216() {
global $wpdb;
$meta_key = $wpdb->get_blog_prefix() . Yoast_Notification_Center::STORAGE_KEY;

$usermetas = $wpdb->get_results(
$wpdb->prepare(
'
SELECT user_id, meta_value
FROM ' . $wpdb->usermeta . '
WHERE meta_key = %s
',
$meta_key
),
ARRAY_A
);

if ( empty( $usermetas ) ) {
return;
}

foreach ( $usermetas as $usermeta ) {
$notifications = maybe_unserialize( $usermeta['meta_value'] );

foreach ( $notifications as $notification ) {
if ( ! empty( $notification['options']['user'] ) ) {
unset( $notification['options']['user'] );
$notification['options']['user_id'] = $usermeta['user_id'];
}
}
update_user_meta( $usermeta['user_id'], Yoast_Notification_Center::STORAGE_KEY, $notifications );
}
}
/**
* Sets the home_url option for the 15.1 upgrade routine.
*
Expand Down

0 comments on commit 21550f4

Please sign in to comment.