Make WordPress Core


Ignore:
Timestamp:
08/15/2009 12:01:04 PM (15 years ago)
Author:
azaozz
Message:

Add constants for ftp connections timeouts, props dd32, see #10522

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/class-wp-filesystem-ftpext.php

    r11821 r11823  
    1717class WP_Filesystem_FTPext extends WP_Filesystem_Base {
    1818    var $link;
    19     var $timeout = 5;
    2019    var $errors = null;
    2120    var $options = array();
     
    3433
    3534        // Set defaults:
     35        //This Class uses the timeout on a per-connection basis, Others use it on a per-action basis.
     36
     37        if ( ! defined('FS_TIMEOUT') )
     38            define('FS_TIMEOUT', 240);
     39
    3640        if ( empty($opt['port']) )
    3741            $this->options['port'] = 21;
     
    6569    function connect() {
    6670        if ( isset($this->options['ssl']) && $this->options['ssl'] && function_exists('ftp_ssl_connect') )
    67             $this->link = @ftp_ssl_connect($this->options['hostname'], $this->options['port'], $this->timeout);
    68         else
    69             $this->link = @ftp_connect($this->options['hostname'], $this->options['port'], $this->timeout);
     71            $this->link = @ftp_ssl_connect($this->options['hostname'], $this->options['port'], FS_CONNECT_TIMEOUT);
     72        else
     73            $this->link = @ftp_connect($this->options['hostname'], $this->options['port'], FS_CONNECT_TIMEOUT);
    7074
    7175        if ( ! $this->link ) {
     
    8185        //Set the Connection to use Passive FTP
    8286        @ftp_pasv( $this->link, true );
     87        if ( @ftp_get_option($this->link, FTP_TIMEOUT_SEC) < FTP_TIMEOUT )
     88            @ftp_set_option($this->link, FTP_TIMEOUT_SEC, FTP_TIMEOUT);
    8389
    8490        return true;
Note: See TracChangeset for help on using the changeset viewer.