Upgrade/Install: Improved inline docs for the plugin and theme updater maintenance mode functionality.

Props bookdude13

See #49400
Built from https://develop.svn.wordpress.org/trunk@47409


git-svn-id: http://core.svn.wordpress.org/trunk@47196 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
John Blackbourn 2020-03-03 00:29:06 +00:00
parent cc17fee089
commit 9860470360
3 changed files with 32 additions and 28 deletions

View File

@ -444,15 +444,15 @@ class Plugin_Upgrader extends WP_Upgrader {
} }
/** /**
* Turn on maintenance mode before attempting to background update an active plugin. * Turns on maintenance mode before attempting to background update an active plugin.
* *
* Hooked to the {@see 'upgrader_pre_install'} filter by Plugin_Upgrader::upgrade(). * Hooked to the {@see 'upgrader_pre_install'} filter by Plugin_Upgrader::upgrade().
* *
* @since 5.4.0 * @since 5.4.0
* *
* @param bool|WP_Error $return * @param bool|WP_Error $return Upgrade offer return.
* @param array $plugin * @param array $plugin Plugin package arguments.
* @return bool|WP_Error * @return bool|WP_Error The passed in $return param or WP_Error.
*/ */
public function active_before( $return, $plugin ) { public function active_before( $return, $plugin ) {
if ( is_wp_error( $return ) ) { if ( is_wp_error( $return ) ) {
@ -466,11 +466,12 @@ class Plugin_Upgrader extends WP_Upgrader {
$plugin = isset( $plugin['plugin'] ) ? $plugin['plugin'] : ''; $plugin = isset( $plugin['plugin'] ) ? $plugin['plugin'] : '';
if ( ! is_plugin_active( $plugin ) ) { // If not active. // Only run if plugin is active
if ( ! is_plugin_active( $plugin ) ) {
return $return; return $return;
} }
// Bulk edit handles maintenance mode separately. // Change to maintenance mode. Bulk edit handles this separately.
if ( ! $this->bulk ) { if ( ! $this->bulk ) {
$this->maintenance_mode( true ); $this->maintenance_mode( true );
} }
@ -479,15 +480,15 @@ class Plugin_Upgrader extends WP_Upgrader {
} }
/** /**
* Turn off maintenance mode after upgrading an active plugin. * Turns off maintenance mode after upgrading an active plugin.
* *
* Hooked to the {@see 'upgrader_post_install'} filter by Plugin_Upgrader::upgrade(). * Hooked to the {@see 'upgrader_post_install'} filter by Plugin_Upgrader::upgrade().
* *
* @since 5.4.0 * @since 5.4.0
* *
* @param bool|WP_Error $return * @param bool|WP_Error $return Upgrade offer return.
* @param array $plugin * @param array $plugin Plugin package arguments.
* @return bool|WP_Error * @return bool|WP_Error The passed in $return param or WP_Error.
*/ */
public function active_after( $return, $plugin ) { public function active_after( $return, $plugin ) {
if ( is_wp_error( $return ) ) { if ( is_wp_error( $return ) ) {
@ -501,11 +502,12 @@ class Plugin_Upgrader extends WP_Upgrader {
$plugin = isset( $plugin['plugin'] ) ? $plugin['plugin'] : ''; $plugin = isset( $plugin['plugin'] ) ? $plugin['plugin'] : '';
if ( ! is_plugin_active( $plugin ) ) { // If not active. // Only run if plugin is active
if ( ! is_plugin_active( $plugin ) ) {
return $return; return $return;
} }
// Bulk edit handles maintenance mode separately. // Time to remove maintenance mode. Bulk edit handles this separately.
if ( ! $this->bulk ) { if ( ! $this->bulk ) {
$this->maintenance_mode( false ); $this->maintenance_mode( false );
} }
@ -514,7 +516,7 @@ class Plugin_Upgrader extends WP_Upgrader {
} }
/** /**
* Delete the old plugin during an upgrade. * Deletes the old plugin during an upgrade.
* *
* Hooked to the {@see 'upgrader_clear_destination'} filter by * Hooked to the {@see 'upgrader_clear_destination'} filter by
* Plugin_Upgrader::upgrade() and Plugin_Upgrader::bulk_upgrade(). * Plugin_Upgrader::upgrade() and Plugin_Upgrader::bulk_upgrade().
@ -523,10 +525,10 @@ class Plugin_Upgrader extends WP_Upgrader {
* *
* @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass. * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass.
* *
* @param bool|WP_Error $removed * @param bool|WP_Error $removed Whether the destination was cleared. true on success, WP_Error on failure.
* @param string $local_destination * @param string $local_destination The local package destination.
* @param string $remote_destination * @param string $remote_destination The remote package destination.
* @param array $plugin * @param array $plugin Extra arguments passed to hooked filters.
* @return bool|WP_Error * @return bool|WP_Error
*/ */
public function delete_old_plugin( $removed, $local_destination, $remote_destination, $plugin ) { public function delete_old_plugin( $removed, $local_destination, $remote_destination, $plugin ) {

View File

@ -528,9 +528,9 @@ class Theme_Upgrader extends WP_Upgrader {
* *
* @since 2.8.0 * @since 2.8.0
* *
* @param bool|WP_Error $return * @param bool|WP_Error $return Upgrade offer return.
* @param array $theme * @param array $theme Theme arguments.
* @return bool|WP_Error * @return bool|WP_Error The passed in $return param or WP_Error.
*/ */
public function current_before( $return, $theme ) { public function current_before( $return, $theme ) {
if ( is_wp_error( $return ) ) { if ( is_wp_error( $return ) ) {
@ -539,11 +539,12 @@ class Theme_Upgrader extends WP_Upgrader {
$theme = isset( $theme['theme'] ) ? $theme['theme'] : ''; $theme = isset( $theme['theme'] ) ? $theme['theme'] : '';
if ( get_stylesheet() !== $theme ) { // If not current. // Only run if current theme
if ( get_stylesheet() !== $theme ) {
return $return; return $return;
} }
// Change to maintenance mode now. // Change to maintenance mode. Bulk edit handles this separately.
if ( ! $this->bulk ) { if ( ! $this->bulk ) {
$this->maintenance_mode( true ); $this->maintenance_mode( true );
} }
@ -559,9 +560,9 @@ class Theme_Upgrader extends WP_Upgrader {
* *
* @since 2.8.0 * @since 2.8.0
* *
* @param bool|WP_Error $return * @param bool|WP_Error $return Upgrade offer return.
* @param array $theme * @param array $theme Theme arguments.
* @return bool|WP_Error * @return bool|WP_Error The passed in $return param or WP_Error.
*/ */
public function current_after( $return, $theme ) { public function current_after( $return, $theme ) {
if ( is_wp_error( $return ) ) { if ( is_wp_error( $return ) ) {
@ -570,7 +571,8 @@ class Theme_Upgrader extends WP_Upgrader {
$theme = isset( $theme['theme'] ) ? $theme['theme'] : ''; $theme = isset( $theme['theme'] ) ? $theme['theme'] : '';
if ( get_stylesheet() !== $theme ) { // If not current. // Only run if current theme
if ( get_stylesheet() !== $theme ) {
return $return; return $return;
} }
@ -581,7 +583,7 @@ class Theme_Upgrader extends WP_Upgrader {
switch_theme( $stylesheet ); switch_theme( $stylesheet );
} }
// Time to remove maintenance mode. // Time to remove maintenance mode. Bulk edit handles this separately.
if ( ! $this->bulk ) { if ( ! $this->bulk ) {
$this->maintenance_mode( false ); $this->maintenance_mode( false );
} }

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.4-beta3-47408'; $wp_version = '5.4-beta3-47409';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.