WordPress.org

Make WordPress Core

Opened 11 days ago

Last modified 10 days ago

#49400 reopened enhancement

Enable maintenance mode when a plugin auto-updates

Reported by: desrosj Owned by: desrosj
Milestone: 5.4 Priority: normal
Severity: normal Version:
Component: Upgrade/Install Keywords: has-patch
Focuses: docs Cc:

Description

Currently, when an active plugin is auto-updating, it remains active and the site does not enter maintenance mode.

This can cause a few issues:

  • If a user loads the Plugins screen in the admin, the plugin could deactivate if an error is encountered mid upgrade.
  • If a user loads the front end of the website and an error is encountered, the WSOD protection will be triggered sending a "false alarm" email to the site admin.

This is a spin-off of #48850 to tackle this in a smaller chunk.

Also potentially related: #34676.

Attachments (2)

49400.diff (3.3 KB) - added by desrosj 11 days ago.
49400.1.patch (5.1 KB) - added by dkarfa 11 days ago.

Download all attachments as: .zip

Change History (7)

#1 @desrosj
11 days ago

  • Keywords needs-testing added

49400.diff uses the same approach that is used in the Theme_Upgrader class, hooking into the pre-install/post-install filters.

#2 @desrosj
11 days ago

  • Milestone changed from Awaiting Review to 5.4

@desrosj
11 days ago

@dkarfa
11 days ago

#3 @SergeyBiryukov
10 days ago

The documentation fixes in 49400.1.patch look good at a glance, but I'd like to make sure they're consistent with class-theme-upgrader.php.

Let's get 49400.diff in for now, and improve the docs after Beta 1.

#4 @desrosj
10 days ago

  • Owner set to desrosj
  • Resolution set to fixed
  • Status changed from new to closed

In 47275:

Upgrade/Install: Enable maintenance mode when plugins are auto-updated.

When an attempt is made to update an active plugin automatically, there is the potential currently for two negative scenarios:

  • The plugin can be deactivated if the Plugins admin screen is loaded when the plugin update is incomplete, causing a PHP error.
  • The WSOD protection could be triggered, sending a false alarm email to the site administrator.

By enabling maintenance mode before an active plugin update is attempted, these scenarios can be avoided.

This change implements the same approach as the Theme_Upgrader class of using the upgrader_pre_install and upgrader_post_install hooks to toggle maintenance mode.

Props desrosj, SergeyBiryukov.
Fixes #49400.

#5 @desrosj
10 days ago

  • Focuses docs added
  • Keywords needs-testing removed
  • Resolution fixed deleted
  • Status changed from closed to reopened

Reopening to improve the inline documentation during beta.

Note: See TracTickets for help on using tickets.