WordPress.org

Make WordPress Core

Opened 9 months ago

Last modified 9 months ago

#49188 new enhancement

Add a check for tables structures.

Reported by: xkon Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Site Health Keywords: 2nd-opinion dev-feedback has-patch
Focuses: Cc:

Description

While reading #47714, I had this idea as I've seen a lot of sites especially after migrations/restorations where the DB structures weren't implemented as planned and nobody noticed, leading into WordPress not being able to work properly.

Core table structures shouldn't be altered I believe unless a database is customized in general so for the majority it should always be the same and as instructed by the installation (do tell me if I have this completely off :D).

I believe that managing a test for core table structures would be of great benefit as migrations/restorations can't be avoided at some point & it would also be considered a critical issue.

We could also create extra documentation to point at if there's a problem with some "copy, modify & paste" SQL to restore the structures as supposed to be.

Any thoughts on this? There might be plugins out there doing this already but I do believe it could be a nice addition to Site Health for checking core-related tables.

Attachments (3)

49188.diff (17.8 KB) - added by xkon 9 months ago.
first pass for core tables ( single site )
49188_passing.jpg (35.1 KB) - added by xkon 9 months ago.
49188_is_critical.jpg (48.7 KB) - added by xkon 9 months ago.

Download all attachments as: .zip

Change History (5)

@xkon
9 months ago

first pass for core tables ( single site )

@xkon
9 months ago

#1 @xkon
9 months ago

  • Keywords has-patch added

49188.diff makes a first pass on a possible way of introducing a check for Site Health as described in the description of this ticket.

I added the single-site tables for the time being as I was creating the patch there but we can easily expand the $serialized_tables for Multisite & subsite support as well as needed.

I wasn't really sure if I could somehow parse the existing schema from somewhere (i.e. wp_get_db_schema) to be honest so I chose to "re-add" an array of the structures but serialized for easier validation, which means that if we choose this way this array should also be updated on any base DB changes.

I haven't given much attention to wording at the moment but a quick preview can be seen on 49188_is_critical.jpg & 49188_passing.jpg depending on the results.

This ticket was mentioned in Slack in #core-site-health by xkon. View the logs.


9 months ago

Note: See TracTickets for help on using tickets.