WordPress.org

Make WordPress Core


Ignore:
Timestamp:
09/11/2012 02:08:29 AM (8 years ago)
Author:
nacin
Message:

Remove old edit_*_per_page usermeta keys.

These per-page values were when the post type or taxonomy name has a hyphen.
Previously, these were converted to underscores. This changed in [21322].

fixes #18958.

File:
1 edited

Legend:

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

    r21804 r21811  
    400400        upgrade_340();
    401401
    402     if ( $wp_current_db_version < 21501 )
     402    if ( $wp_current_db_version < 21811 )
    403403        upgrade_350();
    404404
     
    11961196    if ( $wp_current_db_version < 21501 && $wpdb->get_var( "SELECT link_id FROM $wpdb->links LIMIT 1" ) )
    11971197        update_option( 'link_manager_enabled', 1 ); // Previously set to 0 by populate_options()
     1198
     1199    if ( $wp_current_db_version < 21811 && is_main_site() && ! defined( 'DO_NOT_UPGRADE_GLOBAL_TABLES' ) ) {
     1200        $meta_keys = array();
     1201        foreach ( array_merge( get_post_types(), get_taxonomies() ) as $name ) {
     1202            if ( false !== strpos( $name, '-' ) )
     1203            $meta_keys[] = 'edit_' . str_replace( '-', '_', $name ) . '_per_page';
     1204        }
     1205        if ( $meta_keys ) {
     1206            $meta_keys = implode( "', '", $meta_keys );
     1207            $wpdb->query( "DELETE FROM $wpdb->usermeta WHERE meta_key IN ('$meta_keys')" );
     1208        }
     1209    }
     1210
    11981211}
    11991212
Note: See TracChangeset for help on using the changeset viewer.