Skip to content

Commit

Permalink
Database: Remove the check for sitecategories table on Database Rep…
Browse files Browse the repository at this point in the history
…air 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.

git-svn-id: https://develop.svn.wordpress.org/trunk@55421 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
SergeyBiryukov committed Feb 24, 2023
1 parent 5fd8bed commit 1b949de
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions src/wp-admin/maint/repair.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,6 @@

$tables = $wpdb->tables();

// Sitecategories may not exist if global terms are disabled.
$query = $wpdb->prepare( 'SHOW TABLES LIKE %s', $wpdb->esc_like( $wpdb->sitecategories ) );
if ( is_multisite() && ! $wpdb->get_var( $query ) ) {
unset( $tables['sitecategories'] );
}

/**
* Filters additional database tables to repair.
*
Expand Down

0 comments on commit 1b949de

Please sign in to comment.