Ticket #10522: 10522.diff
File 10522.diff, 4.2 KB (added by , 15 years ago) |
---|
-
wp-admin/includes/class-wp-filesystem-ftpext.php
16 16 */ 17 17 class WP_Filesystem_FTPext extends WP_Filesystem_Base { 18 18 var $link; 19 var $timeout = 5;20 19 var $errors = null; 21 20 var $options = array(); 22 21 … … 33 32 } 34 33 35 34 // 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 36 40 if ( empty($opt['port']) ) 37 41 $this->options['port'] = 21; 38 42 else … … 64 68 65 69 function connect() { 66 70 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);71 $this->link = @ftp_ssl_connect($this->options['hostname'], $this->options['port'], FS_CONNECT_TIMEOUT); 68 72 else 69 $this->link = @ftp_connect($this->options['hostname'], $this->options['port'], $this->timeout);73 $this->link = @ftp_connect($this->options['hostname'], $this->options['port'], FS_CONNECT_TIMEOUT); 70 74 71 75 if ( ! $this->link ) { 72 76 $this->errors->add('connect', sprintf(__('Failed to connect to FTP Server %1$s:%2$s'), $this->options['hostname'], $this->options['port'])); … … 80 84 81 85 //Set the Connection to use Passive FTP 82 86 @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); 83 89 84 90 return true; 85 91 } -
wp-admin/includes/class-wp-filesystem-ftpsockets.php
16 16 */ 17 17 class WP_Filesystem_ftpsockets extends WP_Filesystem_Base { 18 18 var $ftp = false; 19 var $timeout = 5;20 19 var $errors = null; 21 20 var $options = array(); 22 21 … … 61 60 if ( ! $this->ftp ) 62 61 return false; 63 62 64 //$this->ftp->Verbose = true;63 $this->ftp->setTimeout(FS_CONNECT_TIMEOUT); 65 64 66 65 if ( ! $this->ftp->SetServer($this->options['hostname'], $this->options['port']) ) { 67 66 $this->errors->add('connect', sprintf(__('Failed to connect to FTP Server %1$s:%2$s'), $this->options['hostname'], $this->options['port'])); 68 67 return false; 69 68 } 69 70 70 if ( ! $this->ftp->connect() ) { 71 71 $this->errors->add('connect', sprintf(__('Failed to connect to FTP Server %1$s:%2$s'), $this->options['hostname'], $this->options['port'])); 72 72 return false; … … 79 79 80 80 $this->ftp->SetType(FTP_AUTOASCII); 81 81 $this->ftp->Passive(true); 82 $this->ftp->setTimeout(FS_TIMEOUT); 82 83 return true; 83 84 } 84 85 -
wp-admin/includes/class-wp-filesystem-ssh2.php
45 45 var $link = false; 46 46 var $sftp_link = false; 47 47 var $keys = false; 48 /*49 * This is the timeout value for ssh results.50 * Slower servers might need this incressed, but this number otherwise should not change.51 *52 * @parm $timeout int53 *54 */55 var $timeout = 15;56 48 var $errors = array(); 57 49 var $options = array(); 58 50 … … 148 140 $this->errors->add('command', sprintf(__('Unable to perform command: %s'), $command)); 149 141 } else { 150 142 stream_set_blocking( $stream, true ); 151 stream_set_timeout( $stream, $this->timeout);143 stream_set_timeout( $stream, FS_TIMEOUT ); 152 144 $data = stream_get_contents( $stream ); 153 145 fclose( $stream ); 154 146 -
wp-admin/includes/file.php
617 617 if ( ! defined('FS_CHMOD_FILE') ) 618 618 define('FS_CHMOD_FILE', 0644 ); 619 619 620 //And the timeout constants. 621 if ( ! defined('FS_CONNECT_TIMEOUT') ) 622 define('FS_CONNECT_TIMEOUT', 30); 623 if ( ! defined('FS_TIMEOUT') ) 624 define('FS_TIMEOUT', 30); 625 620 626 return true; 621 627 } 622 628