[wp-testers] Suggestion to fix : Download failed.: Operation
timed out after 30 seconds.
Peter Westwood
peter.westwood at ftwr.co.uk
Sun Feb 22 21:58:43 GMT 2009
On 22 Feb 2009, at 12:01, Felix Ker wrote:
> Hi,
>
> I refer to the problem ( (Download failed.: Operation timed out after
> 3000 milli seconds. ...) I always got while trying to upgrade my
> Wordpress plugins or from 2.7 to 2.7.1. Oh, my hosting svr is located
> in Singapore. I'm suggesting that there be a setting for users that
> allows changing of this setting in Wordpress under settings. It can be
> quite irritating that for every site I have, I modify the value and
> after every upgrade, I modify it again.
The 30 second time out is filterable.
You should be able to use the 'http_request_args' filter which is
called in the WP_Http object request function to change the timeout.
It is called like this: $r = apply_filters( 'http_request_args', $r,
$url );
$r['timeout] will contain the timeout if one has been specified by any
caller of the HTTP API and you can change it as you wish without
editing core files.
(The default value if not supplied by a caller is 5 seconds and can be
filtered using the http_request_timeout filter in the same function).
Something like the following in a plugin should help you:
function filter_timeout($r)
{
if (30 == $r['timeout'])
$r['timeout'] = 100;
return ($r);
}
add_filter('http_request_args',''filter_timeout')
westi
--
Peter Westwood
http://blog.ftwr.co.uk | http://westi.wordpress.com
C53C F8FC 8796 8508 88D6 C950 54F4 5DCD A834 01C5
More information about the wp-testers
mailing list