function __construct()
 {
     global $bp;
     // Ensure that we have access to some utility functions. Must use require_once()
     // because BP Core is loaded during incremental upgrades
     require_once BP_PLUGIN_DIR . '/bp-core/bp-core-functions.php';
     // Get current DB version
     $this->db_version_raw = !empty($bp->db_version_raw) ? (int) $bp->db_version_raw : 0;
     if (!empty($bp->is_network_activate)) {
         $this->is_network_activate = $bp->is_network_activate;
     } elseif (!$this->current_step()) {
         setcookie('bp-wizard-step', 0, time() + 60 * 60 * 24, COOKIEPATH);
         $_COOKIE['bp-wizard-step'] = 0;
     }
     $this->db_version = bp_get_db_version();
     $this->setup_type = !empty($bp->maintenance_mode) ? $bp->maintenance_mode : '';
     $this->current_step = $this->current_step();
     // Remove the admin menu while we update/install
     remove_action(bp_core_admin_hook(), 'bp_core_add_admin_menu', 9);
     // Call the save method that will save data and modify $current_step
     if (isset($_POST['save'])) {
         $this->save($_POST['save']);
     }
     // Build the steps needed for update or new installations
     $this->steps = $this->add_steps();
 }
/**
 * Compare the BuddyPress version to the DB version to determine if updating
 *
 * @since BuddyPress (1.6)
 *
 * @uses get_option()
 * @uses bp_get_db_version() To get BuddyPress's database version
 * @return bool True if update, False if not
 */
function bp_is_update()
{
    // Current DB version of this site (per site in a multisite network)
    $current_db = get_option('_bp_db_version');
    $current_live = bp_get_db_version();
    // Compare versions (cast as int and bool to be safe)
    $is_update = (bool) ((int) $current_db < (int) $current_live);
    // Return the product of version comparison
    return $is_update;
}
/**
 * Output the BuddyPress database version.
 *
 * @since BuddyPress (1.6.0)
 *
 * @uses bp_get_db_version() To get the BuddyPress database version.
 */
function bp_db_version()
{
    echo bp_get_db_version();
}
/**
 * Update the DB to the latest version
 *
 * @since BuddyPress (1.6)
 *
 * @uses update_option()
 * @uses bp_get_db_version() To get BuddyPress's database version
 * @uses bp_update_option() To update BuddyPress's database version
 */
function bp_version_bump()
{
    bp_update_option('_bp_db_version', bp_get_db_version());
}
/**
 * Update the DB to the latest version
 *
 * @since BuddyPress (1.6)
 *
 * @uses update_option()
 * @uses bp_get_db_version() To get BuddyPress's database version
 * @uses bp_update_option() To update BuddyPress's database version
 */
function bp_version_bump()
{
    $db_version = bp_get_db_version();
    bp_update_option('_bp_db_version', $db_version);
}
 /** Save Step Methods *****************************************************/
 function step_db_update_save()
 {
     if (isset($_POST['submit'])) {
         check_admin_referer('bpwizard_db_update');
         // Run the schema install to update tables
         bp_core_install();
         // Update to 1.5
         if (bp_get_db_version_raw() < 1801) {
             $this->update_1_5();
         }
         // Update to 1.6
         if (bp_get_db_version_raw() < bp_get_db_version()) {
             $this->update_1_6();
         }
         return true;
     }
     return false;
 }