Make WordPress Core

Ticket #10522: class-wp-filesystem-ftpext_and_file_without_timeout_error_message.php.patch

File class-wp-filesystem-ftpext_and_file_without_timeout_error_message.php.patch, 2.1 KB (added by ntm, 16 years ago)
  • class-wp-filesystem-ftpext.php

     
    1616 */
    1717class WP_Filesystem_FTPext extends WP_Filesystem_Base {
    1818        var $link;
    19         var $timeout = 5;
     19        var $timeout = 30;
    2020        var $errors = null;
    2121        var $options = array();
    2222
     
    4343                else
    4444                        $this->options['hostname'] = $opt['hostname'];
    4545
     46                if ( isset($opt['connect_timeout']) && ! empty($opt['connect_timeout']) && 0 < intval($opt['connect_timeout']))
     47                        $this->timeout = intval($opt['connect_timeout']);
     48
    4649                if ( isset($opt['base']) && ! empty($opt['base']) )
    4750                        $this->wp_base = $opt['base'];
    4851
     
    7275                        $this->errors->add('connect', sprintf(__('Failed to connect to FTP Server %1$s:%2$s'), $this->options['hostname'], $this->options['port']));
    7376                        return false;
    7477                }
    75 
     78       
    7679                if ( ! @ftp_login($this->link,$this->options['username'], $this->options['password']) ) {
    7780                        $this->errors->add('auth', sprintf(__('Username/Password incorrect for %s'), $this->options['username']));
    7881                        return false;
  • file.php

     
    679679        $credentials['hostname'] = defined('FTP_HOST') ? FTP_HOST : (!empty($_POST['hostname']) ? $_POST['hostname'] : $credentials['hostname']);
    680680        $credentials['username'] = defined('FTP_USER') ? FTP_USER : (!empty($_POST['username']) ? $_POST['username'] : $credentials['username']);
    681681        $credentials['password'] = defined('FTP_PASS') ? FTP_PASS : (!empty($_POST['password']) ? $_POST['password'] : '');
     682        $credentials['connect_timeout'] = defined('FTP_CONNECT_TIMEOUT') ? FTP_CONNECT_TIMEOUT : (!empty($_POST['connect_timeout']) ? $_POST['connect_timeout'] : $credentials['connect_timeout']);
    682683
    683684        // Check to see if we are setting the public/private keys for ssh
    684685        $credentials['public_key'] = defined('FTP_PUBKEY') ? FTP_PUBKEY : (!empty($_POST['public_key']) ? $_POST['public_key'] : '');