bbp_version_updater()
The version updater looks at what the current database version is, and runs whatever other code is needed.
Description Description
This is most-often used when the data schema changes, but should also be used to correct issues with bbPress meta-data silently on software update.
Source Source
File: includes/core/update.php
function bbp_version_updater() { // Get the raw database version $raw_db_version = (int) bbp_get_db_version_raw(); // Only run updater if previous installation exists if ( ! empty( $raw_db_version ) ) { /** 2.0 Branch ********************************************************/ // 2.0, 2.0.1, 2.0.2, 2.0.3 if ( $raw_db_version < 200 ) { // No changes } /** 2.1 Branch ********************************************************/ // 2.1, 2.1.1 if ( $raw_db_version < 211 ) { /** * Repair private and hidden forum data * * @link https://bbpress.trac.wordpress.org/ticket/1891 */ bbp_admin_repair_forum_visibility(); } /** 2.2 Branch ********************************************************/ // 2.2.x if ( $raw_db_version < 220 ) { // Remove any old bbPress roles bbp_remove_roles(); // Remove capabilities bbp_remove_caps(); } /** 2.3 Branch ********************************************************/ // 2.3.x if ( $raw_db_version < 230 ) { // No changes } /** 2.4 Branch ********************************************************/ // 2.4.x if ( $raw_db_version < 240 ) { // No changes } /** 2.5 Branch ********************************************************/ // 2.5.x if ( $raw_db_version < 250 ) { // No changes } /** 2.6 Branch ********************************************************/ // Smaller installs run the upgrades directly if ( ! bbp_is_large_install() ) { /** * Upgrade user favorites and subscriptions */ if ( $raw_db_version < 261 ) { bbp_admin_upgrade_user_favorites(); bbp_admin_upgrade_user_topic_subscriptions(); bbp_admin_upgrade_user_forum_subscriptions(); } /** * Upgrade user engagements */ if ( $raw_db_version < 262 ) { bbp_admin_upgrade_user_engagements(); } /** * Repair forum hidden reply count */ if ( $raw_db_version < 263 ) { bbp_admin_repair_forum_hidden_reply_count(); } // Large installs require manual intervention } else { /** * Upgrade user favorites and subscriptions */ if ( $raw_db_version < 261 ) { bbp_add_pending_upgrade( 'bbp-user-favorites-move' ); bbp_add_pending_upgrade( 'bbp-user-topic-subscriptions-move' ); bbp_add_pending_upgrade( 'bbp-user-forum-subscriptions-move' ); // Set strategy to pre-2.6 on large network update_option( '_bbp_engagements_strategy', 'user' ); } /** * Upgrade user engagements */ if ( $raw_db_version < 262 ) { bbp_add_pending_upgrade( 'bbp-user-topic-engagements-move' ); // Set strategy to pre-2.6 on large network update_option( '_bbp_engagements_strategy', 'user' ); } /** * Upgrade user engagements */ if ( $raw_db_version < 263 ) { bbp_add_pending_upgrade( 'bbp-forum-hidden-replies' ); } } } /** All done! *************************************************************/ // Bump the version bbp_version_bump(); // Delete rewrite rules to force a flush bbp_delete_rewrite_rules(); }
Changelog Changelog
Version | Description |
---|---|
2.2.0 | Introduced. |