Make WordPress Core

Changeset 55421


Ignore:
Timestamp:
02/24/2023 03:08:26 PM (16 months ago)
Author:
SergeyBiryukov
Message:

Database: Remove the check for sitecategories table on Database Repair screen.

The table is no longer created by core as of WordPress 3.0, and support for global terms was removed in WordPress 6.1, so $wpdb->sitecategories is unset by default.

This commit resolves a "passing null to non-nullable" deprecation notice on PHP 8.1:

Deprecated: addcslashes(): Passing null to parameter #1 ($string) of type string is deprecated in wp-includes/class-wpdb.php on line 1804

The tables_to_repair filter is available for plugins to readd the table or include any additional tables to repair.

Follow-up to [14854], [14880], [54240].

Props ipajen, chiragrathod103, SergeyBiryukov.
Fixes #57762.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/maint/repair.php

    r55276 r55421  
    9898    $tables = $wpdb->tables();
    9999
    100     // Sitecategories may not exist if global terms are disabled.
    101     $query = $wpdb->prepare( 'SHOW TABLES LIKE %s', $wpdb->esc_like( $wpdb->sitecategories ) );
    102     if ( is_multisite() && ! $wpdb->get_var( $query ) ) {
    103         unset( $tables['sitecategories'] );
    104     }
    105 
    106100    /**
    107101     * Filters additional database tables to repair.
Note: See TracChangeset for help on using the changeset viewer.