Make WordPress Core

Changeset 49572


Ignore:
Timestamp:
11/12/2020 05:53:41 PM (3 years ago)
Author:
SergeyBiryukov
Message:

Database: Clean up the post_category column removed from DB schema for new installations in WordPress 2.8.

Its presence may conflict with WP_Post::__get(), which should generally fill the non-existent post_category property, but is not triggered if the column exists in the database.

Follow-up to [10895].

Props leogermani, davidbaumwald, hellofromTonya.
Fixes #51288.

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/upgrade.php

    r49193 r49572  
    875875    }
    876876
     877    if ( $wp_current_db_version < 49572 ) {
     878        upgrade_560();
     879    }
     880
    877881    maybe_disable_link_manager();
    878882
     
    22382242
    22392243/**
     2244 * Executes changes made in WordPress 5.6.0.
     2245 *
     2246 * @ignore
     2247 * @since 5.6.0
     2248 */
     2249function upgrade_560() {
     2250    global $wpdb;
     2251
     2252    // Clean up the `post_category` column removed from schema in version 2.8.0.
     2253    // Its presence may conflict with WP_Post::__get().
     2254    $post_category_exists = $wpdb->get_var( "SHOW COLUMNS FROM $wpdb->posts LIKE 'post_category'" );
     2255    if ( ! is_null( $post_category_exists ) ) {
     2256        $wpdb->query( "ALTER TABLE $wpdb->posts DROP COLUMN `post_category`" );
     2257    }
     2258}
     2259
     2260/**
    22402261 * Executes network-level upgrade routines.
    22412262 *
  • trunk/src/wp-includes/version.php

    r49557 r49572  
    2121 * @global int $wp_db_version
    2222 */
    23 $wp_db_version = 49534;
     23$wp_db_version = 49572;
    2424
    2525/**
Note: See TracChangeset for help on using the changeset viewer.