WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#36875 closed defect (bug) (fixed)

upgrader_process_complete action is not documented well

Reported by: nextendweb Owned by: DrewAPicture
Milestone: 4.6 Priority: normal
Severity: normal Version: 3.7
Component: Upgrade/Install Keywords:
Focuses: docs Cc:
PR Number:

Description

The comment for upgrader_process_complete action indices that the "packages" key will contain the updated packages, but in real for themes it is the "themes" key and for plugins the "plugins" key.

<?php
                /**
                 * Fires when the bulk upgrader process is complete.
                 *
                 * @since 3.6.0
                 *
                 * @param Plugin_Upgrader $this Plugin_Upgrader instance. In other contexts, $this, might
                 *                              be a Theme_Upgrader or Core_Upgrade instance.
                 * @param array           $data {
                 *     Array of bulk item update data.
                 *
                 *     @type string $action   Type of action. Default 'update'.
                 *     @type string $type     Type of update process. Accepts 'plugin', 'theme', or 'core'.
                 *     @type bool   $bulk     Whether the update process is a bulk update. Default true.
                 *     @type array  $packages Array of plugin, theme, or core packages to update.
                 * }
                 */
                do_action( 'upgrader_process_complete', $this, array(
                        'action' => 'update',
                        'type' => 'plugin',
                        'bulk' => true,
                        'plugins' => $plugins,
                ) );
<?php
                /** This action is documented in wp-admin/includes/class-wp-upgrader.php */
                do_action( 'upgrader_process_complete', $this, array(
                        'action' => 'update',
                        'type' => 'theme',
                        'bulk' => true,
                        'themes' => $themes,
                ) );

Change History (4)

#1 @DrewAPicture
3 years ago

  • Milestone changed from Awaiting Review to 4.6
  • Resolution set to fixed
  • Status changed from new to closed
  • Type changed from enhancement to defect (bug)
  • Version changed from 4.5.2 to 3.7

Missed this ticket. This was fixed in [37550].

#2 @DrewAPicture
3 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

I see what you're getting at, e.g.

<?php
                /** This action is documented in wp-admin/includes/class-wp-upgrader.php */
                do_action( 'upgrader_process_complete', $this, array(
                        'action' => 'update',
                        'type' => 'theme',
                        'bulk' => true,
                        'themes' => $themes,
                ) );

etc.

#3 @DrewAPicture
3 years ago

  • Owner set to DrewAPicture
  • Resolution set to fixed
  • Status changed from reopened to closed

In 37558:

Docs: Update hook docs for the upgrader_package_options filter and upgrader_process_complete action to reflect expected values in the core, language pack, theme, and plugin contexts.

Props nextendweb for the initial patch.
See [37550]. Fixes #36875.

#4 @nextendweb
3 years ago

Thanks @DrewAPicture It seems fine now :)

Note: See TracTickets for help on using tickets.