Make WordPress Core

Changeset 37965


Ignore:
Timestamp:
07/05/2016 01:27:38 PM (8 years ago)
Author:
ocean90
Message:

Plugins: Clean up uninstall_plugins option during database upgrade.

register_uninstall_hook() is designed to be given a function callback (or a static class variable), not an array/object instance. This got blocked in [16339] but the option itself was never cleaned up.

Props polevaultweb.
Fixes #31625.

Location:
trunk/src
Files:
2 edited

Legend:

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

    r37961 r37965  
    556556        upgrade_450();
    557557
    558     if ( $wp_current_db_version < 37854 )
     558    if ( $wp_current_db_version < 37965 )
    559559        upgrade_460();
    560560
     
    17001700 * @since 4.6.0
    17011701 *
    1702  * @global int  $wp_current_db_version Current database version.
    1703  * @global wpdb $wpdb                  WordPress database abstraction object.
     1702 * @global int $wp_current_db_version Current database version.
    17041703 */
    17051704function upgrade_460() {
    1706     delete_post_meta_by_key( '_post_restored_from' );
     1705    global $wp_current_db_version;
     1706
     1707    // Remove unused post meta.
     1708    if ( $wp_current_db_version < 37854 ) {
     1709        delete_post_meta_by_key( '_post_restored_from' );
     1710    }
     1711
     1712    // Remove plugins with callback as an array object/method as the uninstall hook, see #13786.
     1713    if ( $wp_current_db_version < 37965 ) {
     1714        $uninstall_plugins = get_option( 'uninstall_plugins', array() );
     1715
     1716        if ( ! empty( $uninstall_plugins ) ) {
     1717            foreach ( $uninstall_plugins as $basename => $callback ) {
     1718                if ( is_array( $callback ) && is_object( $callback[0] ) ) {
     1719                    unset( $uninstall_plugins[ $basename ] );
     1720                }
     1721            }
     1722
     1723            update_option( 'uninstall_plugins', $uninstall_plugins );
     1724        }
     1725    }
    17071726}
    17081727
  • trunk/src/wp-includes/version.php

    r37926 r37965  
    1212 * @global int $wp_db_version
    1313 */
    14 $wp_db_version = 37854;
     14$wp_db_version = 37965;
    1515
    1616/**
Note: See TracChangeset for help on using the changeset viewer.