Make WordPress Core

Opened 5 years ago

Last modified 4 years ago

#49188 new enhancement

Add a check for tables structures.

Reported by: xkon's profile 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 5 years ago.
first pass for core tables ( single site )
49188_passing.jpg (35.1 KB) - added by xkon 5 years ago.
49188_is_critical.jpg (48.7 KB) - added by xkon 5 years ago.

Download all attachments as: .zip

Change History (6)

@xkon
5 years ago

first pass for core tables ( single site )

@xkon
5 years ago

#1 @xkon
5 years 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.


5 years ago

#3 @xkon
4 years ago

@Clorith, I was thinking (while revisiting my tickets) should we get this on the plugin first for a try and get some feedback as well? I'd be happy to take a look again and provide a PR there instead.

Note: See TracTickets for help on using tickets.