Make WordPress Core


Ignore:
Timestamp:
03/03/2020 12:27:52 AM (7 years ago)
Author:
johnbillion
Message:

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

Props bookdude13

See #49400

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-plugin-upgrader.php

    r47275 r47409  
    445445
    446446        /**
    447          * Turn on maintenance mode before attempting to background update an active plugin.
     447         * Turns on maintenance mode before attempting to background update an active plugin.
    448448         *
    449449         * Hooked to the {@see 'upgrader_pre_install'} filter by Plugin_Upgrader::upgrade().
    … …  
    451451         * @since 5.4.0
    452452         *
    453          * @param bool|WP_Error  $return
    454          * @param array          $plugin
    455          * @return bool|WP_Error
     453         * @param bool|WP_Error $return Upgrade offer return.
     454         * @param array         $plugin Plugin package arguments.
     455         * @return bool|WP_Error The passed in $return param or WP_Error.
    456456         */
    457457        public function active_before( $return, $plugin ) {
    … …  
    467467                $plugin = isset( $plugin['plugin'] ) ? $plugin['plugin'] : '';
    468468
    469                 if ( ! is_plugin_active( $plugin ) ) { // If not active.
    470                         return $return;
    471                 }
    472 
    473                 // Bulk edit handles maintenance mode separately.
     469                // Only run if plugin is active
     470                if ( ! is_plugin_active( $plugin ) ) {
     471                        return $return;
     472                }
     473
     474                // Change to maintenance mode. Bulk edit handles this separately.
    474475                if ( ! $this->bulk ) {
    475476                        $this->maintenance_mode( true );
    … …  
    480481
    481482        /**
    482          * Turn off maintenance mode after upgrading an active plugin.
     483         * Turns off maintenance mode after upgrading an active plugin.
    483484         *
    484485         * Hooked to the {@see 'upgrader_post_install'} filter by Plugin_Upgrader::upgrade().
    … …  
    486487         * @since 5.4.0
    487488         *
    488          * @param bool|WP_Error  $return
    489          * @param array          $plugin
    490          * @return bool|WP_Error
     489         * @param bool|WP_Error  $return Upgrade offer return.
     490         * @param array          $plugin Plugin package arguments.
     491         * @return bool|WP_Error The passed in $return param or WP_Error.
    491492         */
    492493        public function active_after( $return, $plugin ) {
    … …  
    502503                $plugin = isset( $plugin['plugin'] ) ? $plugin['plugin'] : '';
    503504
    504                 if ( ! is_plugin_active( $plugin ) ) { // If not active.
    505                         return $return;
    506                 }
    507 
    508                 // Bulk edit handles maintenance mode separately.
     505                // Only run if plugin is active
     506                if ( ! is_plugin_active( $plugin ) ) {
     507                        return $return;
     508                }
     509
     510                // Time to remove maintenance mode. Bulk edit handles this separately.
    509511                if ( ! $this->bulk ) {
    510512                        $this->maintenance_mode( false );
    … …  
    515517
    516518        /**
    517          * Delete the old plugin during an upgrade.
     519         * Deletes the old plugin during an upgrade.
    518520         *
    519521         * Hooked to the {@see 'upgrader_clear_destination'} filter by
    … …  
    524526         * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass.
    525527         *
    526          * @param bool|WP_Error $removed
    527          * @param string        $local_destination
    528          * @param string        $remote_destination
    529          * @param array         $plugin
     528         * @param bool|WP_Error $removed            Whether the destination was cleared. true on success, WP_Error on failure.
     529         * @param string        $local_destination  The local package destination.
     530         * @param string        $remote_destination The remote package destination.
     531         * @param array         $plugin             Extra arguments passed to hooked filters.
    530532         * @return bool|WP_Error
    531533         */
Note: See TracChangeset for help on using the changeset viewer.