/**
 * BuddyPress's version updater looks at what the current database version is,
 * and runs whatever other code is needed.
 *
 * This is most-often used when the data schema changes, but should also be used
 * to correct issues with BuddyPress metadata silently on software update.
 *
 * @since BuddyPress (1.7)
 */
function bp_version_updater()
{
    // Get the raw database version
    $raw_db_version = (int) bp_get_db_version_raw();
    $default_components = apply_filters('bp_new_install_default_components', array('activity' => 1, 'members' => 1, 'xprofile' => 1));
    require_once BP_PLUGIN_DIR . '/bp-core/admin/bp-core-schema.php';
    // Install BP schema and activate only Activity and XProfile
    if (bp_is_install()) {
        // Apply schema and set Activity and XProfile components as active
        bp_core_install($default_components);
        bp_update_option('bp-active-components', $default_components);
        bp_core_add_page_mappings($default_components, 'delete');
        // Upgrades
    } else {
        // Run the schema install to update tables
        bp_core_install();
        // 1.5
        if ($raw_db_version < 1801) {
            bp_update_to_1_5();
            bp_core_add_page_mappings($default_components, 'delete');
        }
        // 1.6
        if ($raw_db_version < 6067) {
            bp_update_to_1_6();
        }
    }
    /** All done! *************************************************************/
    // Bump the version
    bp_version_bump();
}
예제 #2
0
/**
 * Initialize an update or installation of BuddyPress.
 *
 * BuddyPress's version updater looks at what the current database version is,
 * and runs whatever other code is needed - either the "update" or "install"
 * code.
 *
 * This is most often used when the data schema changes, but should also be used
 * to correct issues with BuddyPress metadata silently on software update.
 *
 * @since 1.7.0
 */
function bp_version_updater()
{
    // Get the raw database version
    $raw_db_version = (int) bp_get_db_version_raw();
    /**
     * Filters the default components to activate for a new install.
     *
     * @since 1.7.0
     *
     * @param array $value Array of default components to activate.
     */
    $default_components = apply_filters('bp_new_install_default_components', array('activity' => 1, 'members' => 1, 'settings' => 1, 'xprofile' => 1, 'notifications' => 1));
    require_once buddypress()->plugin_dir . '/bp-core/admin/bp-core-admin-schema.php';
    // Install BP schema and activate only Activity and XProfile
    if (bp_is_install()) {
        // Apply schema and set Activity and XProfile components as active
        bp_core_install($default_components);
        bp_update_option('bp-active-components', $default_components);
        bp_core_add_page_mappings($default_components, 'delete');
        // Upgrades
    } else {
        // Run the schema install to update tables
        bp_core_install();
        // 1.5.0
        if ($raw_db_version < 1801) {
            bp_update_to_1_5();
            bp_core_add_page_mappings($default_components, 'delete');
        }
        // 1.6.0
        if ($raw_db_version < 6067) {
            bp_update_to_1_6();
        }
        // 1.9.0
        if ($raw_db_version < 7553) {
            bp_update_to_1_9();
        }
        // 1.9.2
        if ($raw_db_version < 7731) {
            bp_update_to_1_9_2();
        }
        // 2.0.0
        if ($raw_db_version < 7892) {
            bp_update_to_2_0();
        }
        // 2.0.1
        if ($raw_db_version < 8311) {
            bp_update_to_2_0_1();
        }
        // 2.2.0
        if ($raw_db_version < 9181) {
            bp_update_to_2_2();
        }
        // 2.3.0
        if ($raw_db_version < 9615) {
            bp_update_to_2_3();
        }
    }
    /** All done! *************************************************************/
    // Bump the version
    bp_version_bump();
}
예제 #3
0
/**
 * Setup the BuddyPress updater
 *
 * @since BuddyPress (1.6)
 *
 * @uses BBP_Updater
 */
function bp_setup_updater()
{
    // Are we running an outdated version of BuddyPress?
    if (bp_is_update()) {
        // Bump the version
        bp_version_bump();
        // Run the deactivation function to wipe roles, caps, and rewrite rules
        bp_deactivation();
        // Run the activation function to reset roles, caps, and rewrite rules
        bp_activation();
    }
}
/**
 * Initialize an update or installation of BuddyPress.
 *
 * BuddyPress's version updater looks at what the current database version is,
 * and runs whatever other code is needed - either the "update" or "install"
 * code.
 *
 * This is most often used when the data schema changes, but should also be used
 * to correct issues with BuddyPress metadata silently on software update.
 *
 * @since 1.7.0
 */
function bp_version_updater()
{
    // Get the raw database version.
    $raw_db_version = (int) bp_get_db_version_raw();
    /**
     * Filters the default components to activate for a new install.
     *
     * @since 1.7.0
     *
     * @param array $value Array of default components to activate.
     */
    $default_components = apply_filters('bp_new_install_default_components', array('activity' => 1, 'members' => 1, 'settings' => 1, 'xprofile' => 1, 'notifications' => 1));
    require_once ABSPATH . 'wp-admin/includes/upgrade.php';
    require_once buddypress()->plugin_dir . '/bp-core/admin/bp-core-admin-schema.php';
    $switched_to_root_blog = false;
    // Make sure the current blog is set to the root blog.
    if (!bp_is_root_blog()) {
        switch_to_blog(bp_get_root_blog_id());
        bp_register_taxonomies();
        $switched_to_root_blog = true;
    }
    // Install BP schema and activate only Activity and XProfile.
    if (bp_is_install()) {
        // Apply schema and set Activity and XProfile components as active.
        bp_core_install($default_components);
        bp_update_option('bp-active-components', $default_components);
        bp_core_add_page_mappings($default_components, 'delete');
        bp_core_install_emails();
        // Upgrades.
    } else {
        // Run the schema install to update tables.
        bp_core_install();
        // Version 1.5.0.
        if ($raw_db_version < 1801) {
            bp_update_to_1_5();
            bp_core_add_page_mappings($default_components, 'delete');
        }
        // Version 1.6.0.
        if ($raw_db_version < 6067) {
            bp_update_to_1_6();
        }
        // Version 1.9.0.
        if ($raw_db_version < 7553) {
            bp_update_to_1_9();
        }
        // Version 1.9.2.
        if ($raw_db_version < 7731) {
            bp_update_to_1_9_2();
        }
        // Version 2.0.0.
        if ($raw_db_version < 7892) {
            bp_update_to_2_0();
        }
        // Version 2.0.1.
        if ($raw_db_version < 8311) {
            bp_update_to_2_0_1();
        }
        // Version 2.2.0.
        if ($raw_db_version < 9181) {
            bp_update_to_2_2();
        }
        // Version 2.3.0.
        if ($raw_db_version < 9615) {
            bp_update_to_2_3();
        }
        // Version 2.5.0.
        if ($raw_db_version < 10440) {
            bp_update_to_2_5();
        }
        // Version 2.7.0.
        if ($raw_db_version < 11105) {
            bp_update_to_2_7();
        }
    }
    /* All done! *************************************************************/
    // Bump the version.
    bp_version_bump();
    if ($switched_to_root_blog) {
        restore_current_blog();
    }
}
예제 #5
0
 function step_finish_save()
 {
     if (isset($_POST['submit'])) {
         check_admin_referer('bpwizard_finish');
         // Update the DB version in the database
         bp_version_bump();
         // Delete the setup cookie
         @setcookie('bp-wizard-step', '', time() - 3600, COOKIEPATH);
         // Redirect to the BuddyPress dashboard
         $redirect = bp_core_do_network_admin() ? network_admin_url('settings.php') : admin_url('options-general.php');
         $redirect = add_query_arg(array('page' => 'bp-components'), $redirect);
         wp_safe_redirect($redirect);
         // That's all!
         exit;
     }
     return false;
 }