Upgrader: Allow plugins to short-circuit the package download. Props rmccue and DrewAPicture. Fixes #22378

git-svn-id: https://develop.svn.wordpress.org/trunk@25427 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dion Hulse 2013-09-13 12:52:28 +00:00
parent 4da6ecff26
commit 9c1b30860c
1 changed files with 13 additions and 0 deletions

View File

@ -108,6 +108,19 @@ class WP_Upgrader {
function download_package($package) {
/**
* Filter whether to return the package.
*
* @since 3.7.0
*
* @param bool $reply Whether to bail without returning the package. Default is false.
* @param string $package The package file name.
* @param object $this The WP_Upgrader instance.
*/
$reply = apply_filters( 'upgrader_pre_download', false, $package, $this );
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..