WordPress.org

Make WordPress Core

Opened 6 months ago

Last modified 5 months ago

#46832 new enhancement

Notice or Warning if a plugin create table and do not delete them

Reported by: sebastienserre Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Plugins Keywords: 2nd-opinion needs-patch dev-feedback
Focuses: administration Cc:
PR Number:

Description

Hello

Lots of plugins are creating their own tables but they don't delete them when the plugin is deleted or deactivated.

Is a way exists (maybe with Healthsite) to check on deactivation if a

CREATE TABLE

exists and if so, if the register_deactivation_hook() is used...

If not used, surely tables are not deleted so => notices

Change History (3)

#2 @subrataemfluence
6 months ago

I have a related question. If a plugin is deleted, any table created by it should also be deleted, which is reasonable. But I think deactivating a plugin should keep a table (if created by it) intact with its data because the same plugin could be activated later on. If table is removed when deactivated, all data in it will be lost. However, this is kind of off topic since this depends on the plugin builders how they see it.

Now, regarding displaying notice, if a plugin is removed completely what is the options left for the core to determine that it was removed but table created by it wasn't if there was no signature of this plugin is left somewhere?

Taking both these use cases into consideration the situations are:

  1. Plugin deactivated, but ideally a table created by it should not be removed, so notice doesn't have much of an impact.
  1. Plugin is removed from the system means WordPress doesn't know anymore that there was a plugin which created a table. So, only displaying notice doesn't make any difference here as well. The only option however, as I see, is to check if there are only bundled / shipped plugins are present and there is/are additional tables exist in the database other than that those created by WordPress installation itself.

The bottom line is, is it really a task of WordPress core to do this stuff or it is the responsibility of the plugin developers to clean up tables like this?

Please correct me if I have not understood the underlying issue properly.

#3 @sebastienserre
5 months ago

  • Focuses administration added
  • Keywords needs-patch dev-feedback added
Note: See TracTickets for help on using tickets.