WordPress.org

Make WordPress Core

Ticket #22378: 22378.diff

File 22378.diff, 578 bytes (added by rmccue, 18 months ago)

Add filter to WP_Upgrader::download_package()

  • wp-admin/includes/class-wp-upgrader.php

    diff --git wp-admin/includes/class-wp-upgrader.php wp-admin/includes/class-wp-upgrader.php
    index ef8fb5f..802f9b0 100644
    class WP_Upgrader { 
    107107 
    108108        function download_package($package) { 
    109109 
     110                $reply = apply_filters('wp_upgrader_pre_download', false, $package, $this); 
     111                if ( false !== $reply ) 
     112                        return $reply; 
     113 
    110114                if ( ! preg_match('!^(http|https|ftp)://!i', $package) && file_exists($package) ) //Local file or remote? 
    111115                        return $package; //must be a local file.. 
    112116