Make WordPress Core

Changeset 16763


Ignore:
Timestamp:
12/07/2010 12:45:24 PM (13 years ago)
Author:
westi
Message:

Allow for the callee of download_url() to specify a different timeout if they want to - maybe they don't want to wait that long.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/file.php

    r16717 r16763  
    508508 *
    509509 * @param string $url the URL of the file to download
     510 * @param int $timeout The timeout for the request to download the file default 300 seconds
    510511 * @return mixed WP_Error on failure, string Filename on success.
    511512 */
    512 function download_url( $url ) {
     513function download_url( $url, $timeout = 300 ) {
    513514    //WARNING: The file is not automatically deleted, The script must unlink() the file.
    514515    if ( ! $url )
     
    523524        return new WP_Error('http_no_file', __('Could not create Temporary file.'));
    524525
    525     $response = wp_remote_get($url, array('timeout' => 300));
     526    $response = wp_remote_get($url, array('timeout' => $timeout));
    526527
    527528    if ( is_wp_error($response) ) {
Note: See TracChangeset for help on using the changeset viewer.