[wp-trac] [WordPress Trac] #10522: timeout for ftp connections as a constant in config.php

WordPress Trac wp-trac at lists.automattic.com
Fri Jul 31 14:32:26 UTC 2009


#10522: timeout for ftp connections as a constant in config.php
--------------------------+-------------------------------------------------
 Reporter:  ntm           |       Owner:  dd32                                   
     Type:  defect (bug)  |      Status:  new                                    
 Priority:  normal        |   Milestone:  2.9                                    
Component:  Filesystem    |     Version:  2.8.2                                  
 Severity:  normal        |    Keywords:  ftp connection timeout, plugin upgrade,
--------------------------+-------------------------------------------------

Comment(by ntm):

 Replying to [comment:3 dd32]:
 > > attachment file.php.patch added
 >
 > Not sure why its being set like that.. No real point
 >
 I have made that because this timeout value is in my opinion part of the
 ftp credentials, too and all other credentials like hostname and username
 are saved in the same way.

 > > attachment class-wp-filesystem-ftpext.php.patch added
 >
 > i'd use the define directly there, ie:
 > {{{
 > if ( defined('TIMEOUT..') )
 > $this->timeout = TIMEOUT...;
 > }}}

 I have oriented myself at the checks of the other values and have added
 {{{
 0 < intval($opt['connect_timeout'])
 }}}
 because on the manual page of [http://www.php.net/manual/en/function.ftp-
 set-option.php ftp_set_option] is written that the timeout value ''must be
 an integer that is greater than 0 [...]''. But i have forgotten to use
 intval in the next line. It should be
 {{{
 $this->timeout = intval($opt['connect_timeout']);
 }}}
 . Or is better to create a new variable and execute intval in every case
 only once?

 > Bad username/password will return instantly anyway..

 That is a good point. I think that it should be changed, too. But to get a
 more precise error message it would probably be necessary to take the time
 during the ftp_login attempt (e.g. with microtime()) and compare it with
 the timeout limit.
 Is that to much?

 > [...] the addition of a higher-than-current timeout by default just for
 those who the slightly higher timeout works for [...]

 I think that, too. How big should the default value be? 15 seconds? 30
 seconds? more? (BTW: the hard coded timeout value for the ssh2 connections
 is already 15 seconds. [http://core.trac.wordpress.org/browser/trunk/wp-
 admin/includes/class-wp-filesystem-ssh2.php class-wp-filesystem-ssh2.php]
 line 55)

 (Later today, I will post a changed and supplemented patch for class-wp-
 filesystem-ftpext.php)

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/10522#comment:8>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list