[wp-trac] [WordPress Trac] #22378: Add ability to hijack plugin install/upgrade downloads
WordPress Trac
noreply at wordpress.org
Wed Nov 7 13:21:39 UTC 2012
#22378: Add ability to hijack plugin install/upgrade downloads
-----------------------------+--------------------
Reporter: rmccue | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: 3.5
Component: Upgrade/Install | Version: trunk
Severity: normal | Resolution:
Keywords: has-patch |
-----------------------------+--------------------
Comment (by rmccue):
Trivial example of how to implement it:
{{{
<?php
function test_new_hook($return, $package, $upgrader) {
if ($return !== false) {
return $return;
}
$package = add_query_arg('key', 'token', $package);
$upgrader->skin->feedback('downloading_package', $package);
$download_file = download_url($package);
if ( is_wp_error($download_file) )
return new WP_Error('download_failed',
$upgrader->strings['download_failed'],
$download_file->get_error_message());
return $download_file;
}
add_filter('wp_upgrader_pre_download', 'test_new_hook', 10, 3);
}}}
--
Ticket URL: <http://core.trac.wordpress.org/ticket/22378#comment:3>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list