Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
02/03/2016 05:01:13 AM (9 years ago)
Author:
tw2113
Message:

Adds many missing @since tags to the BP Core component.

See #6398.

File:
1 edited

Legend:

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

    r10474 r10497  
    4343function bp_is_update() {
    4444
    45     // Current DB version of this site (per site in a multisite network)
     45    // Current DB version of this site (per site in a multisite network).
    4646    $current_db   = bp_get_option( '_bp_db_version' );
    4747    $current_live = bp_get_db_version();
    4848
    49     // Compare versions (cast as int and bool to be safe)
     49    // Compare versions (cast as int and bool to be safe).
    5050    $is_update = (bool) ( (int) $current_db < (int) $current_live );
    5151
    52     // Return the product of version comparison
     52    // Return the product of version comparison.
    5353    return $is_update;
    5454}
     
    7474    }
    7575
    76     // Bail if not activating
     76    // Bail if not activating.
    7777    if ( empty( $action ) || !in_array( $action, array( 'activate', 'activate-selected' ) ) ) {
    7878        return false;
    7979    }
    8080
    81     // The plugin(s) being activated
     81    // The plugin(s) being activated.
    8282    if ( $action == 'activate' ) {
    8383        $plugins = isset( $_GET['plugin'] ) ? array( $_GET['plugin'] ) : array();
     
    8686    }
    8787
    88     // Set basename if empty
     88    // Set basename if empty.
    8989    if ( empty( $basename ) && !empty( $bp->basename ) ) {
    9090        $basename = $bp->basename;
    9191    }
    9292
    93     // Bail if no basename
     93    // Bail if no basename.
    9494    if ( empty( $basename ) ) {
    9595        return false;
     
    120120    }
    121121
    122     // Bail if not deactivating
     122    // Bail if not deactivating.
    123123    if ( empty( $action ) || !in_array( $action, array( 'deactivate', 'deactivate-selected' ) ) ) {
    124124        return false;
    125125    }
    126126
    127     // The plugin(s) being deactivated
     127    // The plugin(s) being deactivated.
    128128    if ( 'deactivate' == $action ) {
    129129        $plugins = isset( $_GET['plugin'] ) ? array( $_GET['plugin'] ) : array();
     
    132132    }
    133133
    134     // Set basename if empty
     134    // Set basename if empty.
    135135    if ( empty( $basename ) && !empty( $bp->basename ) ) {
    136136        $basename = $bp->basename;
    137137    }
    138138
    139     // Bail if no basename
     139    // Bail if no basename.
    140140    if ( empty( $basename ) ) {
    141141        return false;
     
    187187function bp_version_updater() {
    188188
    189     // Get the raw database version
     189    // Get the raw database version.
    190190    $raw_db_version = (int) bp_get_db_version_raw();
    191191
     
    207207    require_once( buddypress()->plugin_dir . '/bp-core/admin/bp-core-admin-schema.php' );
    208208
    209     // Install BP schema and activate only Activity and XProfile
     209    // Install BP schema and activate only Activity and XProfile.
    210210    if ( bp_is_install() ) {
    211211
    212         // Apply schema and set Activity and XProfile components as active
     212        // Apply schema and set Activity and XProfile components as active.
    213213        bp_core_install( $default_components );
    214214        bp_update_option( 'bp-active-components', $default_components );
     
    216216        bp_core_install_emails();
    217217
    218     // Upgrades
     218    // Upgrades.
    219219    } else {
    220220
    221         // Run the schema install to update tables
     221        // Run the schema install to update tables.
    222222        bp_core_install();
    223223
     
    269269    }
    270270
    271     /** All done! *************************************************************/
    272 
    273     // Bump the version
     271    /* All done! *************************************************************/
     272
     273    // Bump the version.
    274274    bp_version_bump();
    275275}
     
    290290    // 2.3.0: Change index lengths to account for utf8mb4.
    291291    if ( $raw_db_version < 9695 ) {
    292         // table_name => columns.
     292        // Map table_name => columns.
    293293        $tables = array(
    294294            $bp_prefix . 'bp_activity_meta'       => array( 'meta_key' ),
     
    321321function bp_update_to_1_5() {
    322322
    323     // Delete old database version options
     323    // Delete old database version options.
    324324    delete_site_option( 'bp-activity-db-version' );
    325325    delete_site_option( 'bp-blogs-db-version'    );
     
    339339function bp_update_to_1_6() {
    340340
    341     // Delete possible site options
     341    // Delete possible site options.
    342342    delete_site_option( 'bp-db-version'       );
    343343    delete_site_option( '_bp_db_version'      );
     
    345345    delete_site_option( '_bp-core-db-version' );
    346346
    347     // Delete possible blog options
     347    // Delete possible blog options.
    348348    delete_blog_option( bp_get_root_blog_id(), 'bp-db-version'       );
    349349    delete_blog_option( bp_get_root_blog_id(), 'bp-core-db-version'  );
     
    363363function bp_update_to_1_9() {
    364364
    365     // Setup hardcoded keys
     365    // Setup hardcoded keys.
    366366    $active_components_key      = 'bp-active-components';
    367367    $notifications_component_id = 'notifications';
    368368
    369     // Get the active components
     369    // Get the active components.
    370370    $active_components          = bp_get_option( $active_components_key );
    371371
    372     // Add notifications
     372    // Add notifications.
    373373    if ( ! in_array( $notifications_component_id, $active_components ) ) {
    374374        $active_components[ $notifications_component_id ] = 1;
    375375    }
    376376
    377     // Update the active components option
     377    // Update the active components option.
    378378    bp_update_option( $active_components_key, $active_components );
    379379}
     
    412412function bp_update_to_2_0() {
    413413
    414     /** Install activity tables for 'last_activity' ***************************/
     414    /* Install activity tables for 'last_activity' ***************************/
    415415
    416416    bp_core_install_activity_streams();
    417417
    418     /** Migrate 'last_activity' data ******************************************/
     418    /* Migrate 'last_activity' data ******************************************/
    419419
    420420    bp_last_activity_migrate();
    421421
    422     /** Migrate signups data **************************************************/
     422    /* Migrate signups data **************************************************/
    423423
    424424    if ( ! is_multisite() ) {
    425425
    426         // Maybe install the signups table
     426        // Maybe install the signups table.
    427427        bp_core_maybe_install_signups();
    428428
    429         // Run the migration script
     429        // Run the migration script.
    430430        bp_members_migrate_signups();
    431431    }
    432432
    433     /** Add BP options to the options table ***********************************/
     433    /* Add BP options to the options table ***********************************/
    434434
    435435    bp_add_options();
     
    461461function bp_update_to_2_2() {
    462462
    463     // Also handled by `bp_core_install()`
     463    // Also handled by `bp_core_install()`.
    464464    if ( bp_is_active( 'messages' ) ) {
    465465        bp_core_install_private_messaging();
     
    484484function bp_update_to_2_3() {
    485485
    486     // Also handled by `bp_core_install()`
     486    // Also handled by `bp_core_install()`.
    487487    if ( bp_is_active( 'notifications' ) ) {
    488488        bp_core_install_notifications();
     
    508508 * @global $wpdb
    509509 * @uses   buddypress()
    510  *
    511510 */
    512511function bp_migrate_new_member_activity_component() {
     
    514513    $bp = buddypress();
    515514
    516     // Update the component for the new_member type
     515    // Update the component for the new_member type.
    517516    $wpdb->update(
    518         // Activity table
     517        // Activity table.
    519518        $bp->members->table_name_last_activity,
    520519        array(
     
    525524            'type'      => 'new_member',
    526525        ),
    527         // Data sanitization format
     526        // Data sanitization format.
    528527        array(
    529528            '%s',
    530529        ),
    531         // WHERE sanitization format
     530        // WHERE sanitization format.
    532531        array(
    533532            '%s',
     
    563562function bp_add_activation_redirect() {
    564563
    565     // Bail if activating from network, or bulk
     564    // Bail if activating from network, or bulk.
    566565    if ( isset( $_GET['activate-multi'] ) ) {
    567566        return;
     
    569568
    570569    // Record that this is a new installation, so we show the right
    571     // welcome message
     570    // welcome message.
    572571    if ( bp_is_install() ) {
    573572        set_transient( '_bp_is_new_install', true, 30 );
    574573    }
    575574
    576     // Add the transient to redirect
     575    // Add the transient to redirect.
    577576    set_transient( '_bp_activation_redirect', true, 30 );
    578577}
     
    586585 *
    587586 * @global WPDB $wpdb
    588  *
    589  * @return bool|null If signups table exists.
    590587 */
    591588function bp_core_maybe_install_signups() {
    592589    global $wpdb;
    593590
    594     // The table to run queries against
     591    // The table to run queries against.
    595592    $signups_table = $wpdb->base_prefix . 'signups';
    596593
    597     // Suppress errors because users shouldn't see what happens next
     594    // Suppress errors because users shouldn't see what happens next.
    598595    $old_suppress  = $wpdb->suppress_errors();
    599596
    600     // Never use bp_core_get_table_prefix() for any global users tables
     597    // Never use bp_core_get_table_prefix() for any global users tables.
    601598    $table_exists  = (bool) $wpdb->get_results( "DESCRIBE {$signups_table};" );
    602599
     
    604601    if ( true === $table_exists ) {
    605602
    606         // Look for the 'signup_id' column
     603        // Look for the 'signup_id' column.
    607604        $column_exists = $wpdb->query( "SHOW COLUMNS FROM {$signups_table} LIKE 'signup_id'" );
    608605
     
    618615    }
    619616
    620     // Restore previous error suppression setting
     617    // Restore previous error suppression setting.
    621618    $wpdb->suppress_errors( $old_suppress );
    622619}
     
    638635    delete_site_transient( 'theme_roots' );
    639636
    640     // Add options
     637    // Add options.
    641638    bp_add_options();
    642639
Note: See TracChangeset for help on using the changeset viewer.