WordPress.org

Ready to get started?Download WordPress

Forums

FTP upgrading broken for me (2 posts)

  1. fwaggle
    Member
    Posted 5 years ago #

    Hi guys,

    I'm wondering if anyone else has had this problem. Automatic updating of plugins isn't working one of my servers - I'm not entirely sure when the problem started. We're using FTP updating, and the offending part of the code is this (wp-admin/includes/wp-filesystem-ftpext.php):

    function exists($file) {
    		$list = @ftp_rawlist($this->link, $file, false);
    		return !empty($list); //empty list = no file, so invert.
    	}

    By inserting a print_r() in there, I've been able to ascertain that the reason it's failing is because my server isn't returning an empty array - it's returning an array with the line (eg if I tamper with the paths so it intentionally fails):

    ftpd: /usr/local/www/fwaggle.org/blog/wp-content: No such file or directory

    Because $list contains an error, it's not empty, so it's returning "yes the file exists". This is throwing off the upgrade script, which is returning a confusing error "directory exists" when if you check via FTP or shell, it clearly doesn't.

    I've managed to work around this in my own, ugly way, but I was just wondering if anyone else has experienced this and knows why behaves in this manner? I'm assuming it's a property of my ftp daemon (stock FreeBSD daemon) but perhaps this behavior should be coded around anyway.

    Thanks for your time, and I look forward to hearing what others think about it.

    Update: Rather than hacking the scripts for every wordpress on my server, I've just temporarily installed ProFTPd instead. Still though, it'd be nice if this were able to be fixed. :D

  2. fwaggle
    Member
    Posted 4 years ago #

    What was the rationalization for choosing ftp_rawlist() in the first place? I've tried to find out why ftp_nlist() wasn't chosen, and I can't seem to find any services it's broken on - at least for the purposes of finding out if a path exists or not.

    The following patch makes exists() work as expected, and fixes the upgrade problems without any nasty hax0ring... so I'd appreciate if anyone smarter than me could take a look at it and let me know if there's any reason it can't go into a future update of WordPress, because it'd make my life a whole lot easier.

    I ran into problems with proftpd, and I don't need a full-fledged FTP daemon - we only run it on localhost specifically for the purpose of upgrading WordPress and it's plugins, so it kinda stinks that it's broken with a stock WordPress. :(

    --- wp-admin/includes/class-wp-filesystem-ftpext.php 2009-08-04 20:55:35.000000000 +0000
    +++ wp-admin/includes/class-wp-filesystem-ftpext.php 2009-08-04 21:11:16.000000000 +0000
    @@ -201,7 +201,7 @@
            }
    
            function exists($file) {
    -               $list = @ftp_rawlist($this->link, $file, false);
    +               $list = @ftp_nlist($this->link, $file);
                    return !empty($list); //empty list = no file, so invert.
            }
            function is_file($file) {

Topic Closed

This topic has been closed to new replies.

About this Topic