wp-admin/includes/class-wp-upgrader.php:307Downloads a package for a WordPress core, plugin, theme, or translation upgrade.
$packagestring$check_signaturesbooloptionalfalse$hook_extraarrayoptionalarray()string|WP_ErrorOne hook fires while WP_Upgrader::download_package() runs, in this order:
Filters whether to download a package for a WordPress core, plugin, theme, or translation upgrade.
public function download_package( $package, $check_signatures = false, $hook_extra = array() ) { /** * Filters whether to download a package for a WordPress core, plugin, theme, or translation upgrade. * * Return a non-false value to short-circuit the download and return that value instead. * * @since 3.7.0 * @since 5.5.0 Added the `$hook_extra` parameter. * * @param false|string|WP_Error $reply Whether to short-circuit the download, the path to the downloaded package, * or a WP_Error object. Default false. * @param string $package The package URI. May be a remote URL or local file path. * @param WP_Upgrader $upgrader The WP_Upgrader instance. * @param array $hook_extra Extra arguments passed to hooked filters. */ $reply = apply_filters( 'upgrader_pre_download', false, $package, $this, $hook_extra ); if ( false !== $reply ) { return $reply; } if ( ! preg_match( '!^(http|https|ftp)://!i', $package ) && file_exists( $package ) ) { // Local file or remote? return $package; // Must be a local file. } if ( empty( $package ) ) { return new WP_Error( 'no_package', $this->strings['no_package'] ); } $this->skin->feedback( 'downloading_package', $package ); $download_file = download_url( $package, 300, $check_signatures ); if ( is_wp_error( $download_file ) && ! $download_file->get_error_data( 'softfail-filename' ) ) { return new WP_Error( 'download_failed', $this->strings['download_failed'], $download_file->get_error_message() ); } return $download_file; }Introduced in 2.8.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
src/wp-admin/includes/class-wp-upgrader.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.