I spent yesterday setting up the new WP plugin and file uploader. Since I want to use ssh2 access, I installed ssh2.so, etc. The good news is that that portion is working. PHP5 (Version 5.2.6-1+lenny3) reports:
Registered PHP Streams: zip, php, file, data, http, ftp, compress.bzip2, compress.zlib, https, ftps, ssh2.shell, ssh2.exec, ssh2.tunnel, ssh2.scp, ssh2.sftp
So far so good, and the good news aren't even over yet. I can authenticate successfully. When I select a plugin for installation, it is being downloaded and extracted. Then things go wrong. This is how it looks:
Installing Plugin: Live Mobile Phone News Ticker 1.0
Downloading install package from http://downloads.wordpress.org/plugin/live-mobile-phone-news-ticker.1.0.zip.
Unpacking the package.
Installing the plugin.
Incompatible Archive
Plugin Install Failed.
I tracked the problem down as follows. What fails is the call to dir() in function dirlist(), file wp-admin/includes/class-wp-filesystem-ssh2.php.
$dir = @dir('ssh2.sftp://' . $this->sftp_link .'/' . ltrim($path, '/') );
$dir ends up being empty, which in turn leads the installer code to believe that the archive it just extracted was empty.
Method install_package() in class-wp-upgrader.php:
elseif ( count($source_files) == 0 )
return new WP_Error('bad_package', $this->strings['bad__package']);
My best guess at this point is that dir() is not happy with the ssh2.sftp URL. If I replace the code in wp-filesystem-ssh2.php shown earlier with a simple $dir = @dir($path, '/');, it all works fine. The plugin is successfully extracted and subsequently visible in the list of installed plugins.
I am pretty confident that there is something messed up in my setup, because if this were a general problem, others would have already noticed and reported it. So, does anybody know why dir() is not doing the right thing for me if it's fed an ssh2.ftp URL? The other file operations seem to be quite happy with it. I doubt, therefore, that it's as simple as PHP not recognizing the URL format. Also, PHP specifically claims to know ssh2.ftp URLs as per phpinfo() output.
Thanks,
-Markus