WordPress.org

Make WordPress Core

Opened 5 months ago

Last modified 5 months ago

#47427 new defect (bug)

deleted pages for a plugin prevent page creation during re-installation of plugin

Reported by: nbi1 Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 5.2.1
Component: Posts, Post Types Keywords: reporter-feedback
Focuses: Cc:
PR Number:

Description

Plugin xyz creates pages 'login' and 'registration' when it is installed. Those pages are subsequently deleted (moved to trash) and the plugin is uninstalled. If the plugin is then re-installed it will not be able to create 'login' and 'registration' because these pages are sitting in trash. That should not happen because an active 'login' page should not be equal to a 'login' page in trash, they should be separate and distinct page instances which cannot affect each other unless the user takes explicit action (similar to the philosophy behind package installation in Linux):

  1. The current behavior should be modified to allow concurrent active and trash instances of the same page.
  2. A plugin should have a force option for creating pages.
  3. There should be a force restore from trash option. The user would need to be warned, but it should be their choice.

Change History (3)

#1 @andraganescu
5 months ago

  • Keywords reporter-feedback added

Hi there @nbi1 and welcome to WordPress Trac. First thank you for your submission, it is an interesting usecase. Second, I have some questions:

Thank you for your time and answers! :)

#2 @nbi1
5 months ago

It's a Wordpress policy decision as to whether or not to enforce good plugin behavior. I think it's in Wordpress best interest to prohibit plugin behaviors that make Wordpress difficult to use. With the current implementation if a plugin fails to create pages the user is left wondering what happened and how to rectify the situation. That's not a very user friendly system.

"wouldn't concurrent trash/live pages be very confusing for users?"

Why would they be? During normal usage/operation the user has no reason to think about the contents of 'trash'. The only reason to access 'trash' directly is in the event that something was accidentally deleted and needs to be restored. It is far more confusing to let plugins install without successfully completing all the required installation steps such as running a page creation wizard. Right now Wordpress treats such a plugin installation as a valid install which in fact it is not because most plugins cannot function properly unless all installation steps were successfully completed.

"can't the plugin make sure to remove the pages it created...."

Yes it could and that would be a good way of dealing with the situation *iff* plugins could reliably identify and remove files that they were responsible for. How to enforce this behavior though?

Although clean installation and un-installation are equally important I'm more concerned about the former because that can be a showstopper that prevents plugin use. With the current implementation why are plugins looking at the contents of 'trash' in order to decide whether or not to run the page creation wizard? No assumptions should be made about the contents of 'trash' so this is a logic error. Is this simply an error on part of the plugin or is this a consequence of some Wordpress restriction/enforcement? In either case it's wrong, makes Wordpress difficult to use, and should be corrected.

#3 @SergeyBiryukov
5 months ago

  • Component changed from General to Posts, Post Types

Related: #11863, #21970.

Note: See TracTickets for help on using tickets.