Skip to:
Content

BuddyPress.org

Ticket #5563: 5563.03.patch

File 5563.03.patch, 1.6 KB (added by r-a-y, 11 years ago)

03.patch tweaks the logic for bp_core_maybe_upgrade_signups() from 02.patch

  • bp-core/admin/bp-core-schema.php

     
    5252                bp_core_install_blog_tracking();
    5353
    5454        // Install the signups table
    55         bp_core_install_signups();
     55        bp_core_maybe_install_signups();
    5656
    5757}
    5858
  • bp-core/bp-core-update.php

     
    490490                return false;
    491491        }
    492492
     493        // Upgrade the signups table if needed
     494        bp_core_maybe_upgrade_signups();
     495
    493496        // Try to install the sign-ups table
    494497        if ( ! is_multisite() && ! bp_core_signups_table_exists() ) {
    495498                bp_core_install_signups();
     
    523526                return false;
    524527        }
    525528
    526         // Actually upgrade the sign-ups table
    527         if ( bp_core_maybe_install_signups() ) {
     529        // check if 'wp_signups' table exists
     530        if ( bp_core_signups_table_exists() ) {
     531                global $wpdb;
     532
     533                // Never use bp_core_get_table_prefix() for any global users tables
     534                $wpdb->signups = $wpdb->base_prefix . 'signups';
     535
     536                // 'signup_id' column already exists; stop now!
     537                // @see https://core.trac.wordpress.org/changeset/25179
     538                if ( 1 === $wpdb->query( "SHOW COLUMNS FROM {$wpdb->signups} LIKE 'signup_id'" ) ) {
     539                        return false;
     540                }
     541
     542                // We need to upgrade the signups table
    528543                bp_core_upgrade_signups();
     544                return true;
     545
     546        // 'wp_signups' table doesn't exist
     547        } else {
     548                return false;
    529549        }
    530550
    531         // Return whether or not the table exists now
    532         return (bool) bp_core_signups_table_exists();
    533551}
    534552
    535553/** Activation Actions ********************************************************/