Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
11/08/2011 08:39:23 PM (13 years ago)
Author:
johnjamesjacoby
Message:

bp-loader.php is a real boy! Introduce BuddyPress class to handle the loading of BuddyPress core and provide declarations to the $bp global variables. Ports several functions and methods from bbPress 2.0 into bp-core-update.php to manage the hand-off into the update routine. See #3739.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core/admin/bp-core-update.php

    r5223 r5309  
    44
    55class BP_Core_Setup_Wizard {
     6
     7    /**
     8     * @var int The current step of the updater
     9     */
    610    var $current_step;
     11
     12    /**
     13     *
     14     * @var array The total steps to be completed
     15     */
    716    var $steps;
    817
    9     var $database_version;
     18    /**
     19     * @var int Database version of current BuddyPress files
     20     */
     21    var $db_version;
     22
     23    /**
     24     * @var int Database version raw from the database connection
     25     */
     26    var $db_version_raw;
     27
     28    /**
     29     * @var int Are we currently network activated
     30     */
    1031    var $is_network_activate;
    11     var $new_version;
     32
     33    /**
     34     * @var string What kind of setup/update are we performing
     35     */
    1236    var $setup_type;
     37
     38    /** Functions *************************************************************/
    1339
    1440    function bp_core_setup_wizard() {
     
    2450
    2551        // Get current DB version
    26         $this->database_version = !empty( $bp->database_version ) ? (int) $bp->database_version : 0;
     52        $this->db_version_raw = !empty( $bp->db_version_raw ) ? (int) $bp->db_version_raw : 0;
    2753
    2854        if ( !empty( $bp->is_network_activate ) ) {
     
    3460        }
    3561
    36         $this->new_version  = constant( 'BP_DB_VERSION' );
     62        $this->db_version   = bp_get_db_version();
    3763        $this->setup_type   = !empty( $bp->maintenance_mode ) ? $bp->maintenance_mode : '';
    3864        $this->current_step = $this->current_step();
     
    82108                $steps[] = __( 'Multisite Update', 'buddypress' );
    83109
    84             if ( $this->database_version < (int) $this->new_version )
     110            if ( $this->db_version_raw < (int) $this->db_version )
    85111                $steps[] = __( 'Database Update', 'buddypress' );
    86112
    87113            // New for BP 1.5
    88             if ( $this->database_version < 1801 || !bp_core_get_directory_page_ids() ) {
     114            if ( $this->db_version_raw < 1801 || !bp_core_get_directory_page_ids() ) {
    89115                $steps[] = __( 'Components', 'buddypress' );
    90116                $steps[] = __( 'Pages', 'buddypress' );
     
    92118
    93119            // New for BP 1.6
    94             if ( $this->database_version < 5222 && !defined( 'BP_USE_WP_ADMIN_BAR' ) )
     120            if ( $this->db_version_raw < 5222 && !defined( 'BP_USE_WP_ADMIN_BAR' ) )
    95121                $steps[] = __( 'Admin Bar', 'buddypress' );
    96122
     
    805831            bp_core_install();
    806832
    807             if ( $this->database_version < 1801 )
     833            if ( $this->db_version_raw < 1801 )
    808834                $this->update_1_5();
    809835
     
    829855            // Transfer important settings from blog options to site options
    830856            $options = array(
    831                 'bp-db-version'        => $this->database_version,
     857                '_bp_db_version'       => $this->db_version,
    832858                'bp-active-components' => $active_components,
    833859                'avatar-default'       => get_option( 'avatar-default' )
     
    844870                // Move bp-pages data from the blog options table to site options
    845871                $existing_pages = bp_get_option( 'bp-pages' );
    846 
    847872                $bp_pages       = $this->setup_pages( (array)$_POST['bp_pages'] );
    848873                $bp_pages       = array_merge( (array)$existing_pages, (array)$bp_pages );
     
    856881            }
    857882
     883            // Delete the old site option
     884            delete_site_option( 'bp-db-version' );
     885
     886            // Update the active components
    858887            bp_update_option( 'bp-active-components', $active_components );
    859888
     
    10921121            // Update the DB version in the database
    10931122            // Stored in sitemeta. Do not use bp_update_option()
    1094             update_site_option( 'bp-db-version', $this->new_version );
     1123            update_site_option( 'bp-db-version', $this->db_version );
    10951124            delete_site_option( 'bp-core-db-version' );
    10961125
Note: See TracChangeset for help on using the changeset viewer.