Skip to:
Content

BuddyPress.org

Changeset 13907


Ignore:
Timestamp:
06/06/2024 08:36:00 PM (20 months ago)
Author:
imath
Message:

Make sure BuddyPress can be previewed using WP Playground

Props espellcaste

Fixes #9126
Closes https://github.com/buddypress/buddypress/pull/287

Location:
trunk
Files:
1 added
3 edited

Legend:

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

    r13886 r13907  
    9292                component_action varchar(75) NOT NULL,
    9393                date_notified datetime NOT NULL,
    94                 is_new bool NOT NULL DEFAULT 0,
     94                is_new tinyint(1) NOT NULL DEFAULT 0,
    9595                KEY item_id (item_id),
    9696                KEY secondary_item_id (secondary_item_id),
     
    135135                secondary_item_id bigint(20) DEFAULT NULL,
    136136                date_recorded datetime NOT NULL,
    137                 hide_sitewide bool DEFAULT 0,
     137                hide_sitewide tinyint(1) DEFAULT 0,
    138138                mptt_left int(11) NOT NULL DEFAULT 0,
    139139                mptt_right int(11) NOT NULL DEFAULT 0,
     
    177177                initiator_user_id bigint(20) NOT NULL,
    178178                friend_user_id bigint(20) NOT NULL,
    179                 is_confirmed bool DEFAULT 0,
    180                 is_limited bool DEFAULT 0,
     179                is_confirmed tinyint(1) DEFAULT 0,
     180                is_limited tinyint(1) DEFAULT 0,
    181181                date_created datetime NOT NULL,
    182182                KEY initiator_user_id (initiator_user_id),
  • trunk/src/bp-core/bp-core-update.php

    r13903 r13907  
    314314        if ( $raw_db_version < 13422 ) {
    315315            bp_update_to_12_0();
     316        }
     317
     318        // Version 14.0.0.
     319        if ( $raw_db_version < 13906 ) {
     320            bp_update_to_14_0();
    316321        }
    317322    }
     
    939944
    940945/**
     946 * 14.0.0 update routine.
     947 *
     948 * Edit db schema to stop using boolean fields in favor of tinyint ones.
     949 * This moves was necessary to support WP Playground.
     950 *
     951 * @since 14.0.0
     952 */
     953function bp_update_to_14_0() {
     954    global $wpdb;
     955    $bp        = buddypress();
     956    $bp_prefix = bp_core_get_table_prefix();
     957
     958    if ( isset( $bp->members->table_name_last_activity ) && $wpdb->get_var( "SHOW TABLES LIKE '%{$bp->members->table_name_last_activity}%'" ) ) {
     959        if ( $wpdb->get_var( "SHOW COLUMNS FROM {$bp->members->table_name_last_activity} LIKE 'hide_sitewide'" ) ) {
     960            $wpdb->query( "ALTER TABLE {$bp->members->table_name_last_activity} CHANGE hide_sitewide hide_sitewide tinyint(1) DEFAULT 0" );
     961        }
     962    }
     963
     964    if ( isset( $bp->friends->table_name ) && $wpdb->get_var( "SHOW TABLES LIKE '%{$bp->friends->table_name}%'" ) ) {
     965        if ( $wpdb->get_var( "SHOW COLUMNS FROM {$bp->friends->table_name} LIKE 'is_confirmed'" ) ) {
     966            $wpdb->query( "ALTER TABLE {$bp->friends->table_name} CHANGE is_confirmed is_confirmed tinyint(1) DEFAULT 0" );
     967        }
     968
     969        if ( $wpdb->get_var( "SHOW COLUMNS FROM {$bp->friends->table_name} LIKE 'is_limited'" ) ) {
     970            $wpdb->query( "ALTER TABLE {$bp->friends->table_name} CHANGE is_limited is_limited tinyint(1) DEFAULT 0" );
     971        }
     972    }
     973
     974    if ( isset( $bp->notifications->table_name ) && $wpdb->get_var( "SHOW TABLES LIKE '%{$bp->notifications->table_name}%'" ) ) {
     975        if ( $wpdb->get_var( "SHOW COLUMNS FROM {$bp->notifications->table_name} LIKE 'is_new'" ) ) {
     976            $wpdb->query( "ALTER TABLE {$bp->notifications->table_name} CHANGE is_new is_new tinyint(1) NOT NULL DEFAULT 0" );
     977        }
     978    }
     979}
     980
     981/**
    941982 * Updates the component field for new_members type.
    942983 *
  • trunk/src/class-buddypress.php

    r13885 r13907  
    462462
    463463        $this->version    = '14.0.0-alpha';
    464         $this->db_version = 13422;
     464        $this->db_version = 13906;
    465465
    466466        /** Loading */
Note: See TracChangeset for help on using the changeset viewer.