[wp-trac] [WordPress Trac] #10195: Unable to update plugins using automatic update over SSH2 since upgrade to 2.8

WordPress Trac wp-trac at lists.automattic.com
Wed Jun 17 01:56:43 GMT 2009


#10195: Unable to update plugins using automatic update over SSH2 since upgrade to
2.8
-----------------------------+----------------------------------------------
 Reporter:  rmckern          |       Owner:  dd32                            
     Type:  defect (bug)     |      Status:  new                             
 Priority:  normal           |   Milestone:  Unassigned                      
Component:  Upgrade/Install  |     Version:  2.8                             
 Severity:  normal           |    Keywords:  ssh2, automatic, upgrade, update
-----------------------------+----------------------------------------------
 After upgrading to WordPress 2.8 on an Apache 2.2/Linux/PHP 5.2.9 machine,
 plugin and core auto-update was broken. The error returned is:


 {{{
 Unable to locate WordPress Content directory (wp-content).
 }}}


 As per standard testing, I changed permissions to various and sundry forms
 ranging from 775 to 777 (apache runs as a user who belongs to the group
 that owns all files and directories underneath the document root). That
 fixed nothing. I tried disabling plugins (one at a time, and then all of
 them) and I tried going back to a bog simple default install. I then
 verified that things worked perfectly under WordPress 2.7.1 with the same
 configuration file. I then began to dig through the wp-admin backend and
 the codex, and set the following in wp-config.php which should have
 overridden the auto-discovery and used explicit paths for wp-content and
 plugins:


 {{{
 define('FTP_PUBKEY','/home/ryan/.ssh/some_wordpress_key.pub');
 define('FTP_PRIKEY','/home/ryan/.ssh/some_wordpress_key');
 define('FTP_USER','ryan');
 define('FTP_PASS',''); \\ There shouldn't be a need for a password, but it
 doesn't make a difference with or without one for this ticket
 define('FTP_HOST','127.0.0.1:22');
 define('FTP_BASE', '/home/ryan/path/to/my/site/public_html/');
 define('FTP_CONTENT_DIR', '/home/ryan/path/to/my/site/public_html/wp-
 content/');
 define('FTP_PLUGIN_DIR', '/home/ryan/path/to/my/site/public_html/wp-
 content/plugins/');
 }}}


 The overrides were picked up by the ssh filesystem module. I dug through
 /wp-admin/includes/class-wp-filesystem-base.php and found where the
 overrides are applied (line 138) and modified it to pick up the overrides
 for SSH as well (as part of the testing process):


 {{{
 if ( strpos($this->method, 'ftp' ) || strpos($this->method, 'ssh2' ) !==
 false )
 }}}


 This let WordPress find the wp-content directory but now I'm receiving the
 following:


 {{{
 Downloading update from
 http://downloads.wordpress.org/plugin/stats.1.4.zip.

 Unpacking the update.

 Could not copy file /home/ryan/path/to/my/site/public_html/wp-
 content/upgrade/stats.1.410/stats/screenshot-1.png

 }}}

 I've now traced that down through /wp-admin/includes/file.php and /wp-
 admin/includes/class-wp-filesystem-ssh2.php to the following failing
 function (lines 177 through 180 of class-wp-filesystem-ssh2.php):


 {{{
 function put_contents($file, $contents, $type = '' ) {
 $file = ltrim($file, '/');
 return file_put_contents('ssh2.sftp://' . $this->sftp_link .'/' . $file,
 $contents);
 }

 }}}

 This is markedly simpler, and more direct than it was in 2.7.1:


 {{{
 function put_contents($file, $contents, $type = '' ) {
 $this->debug("put_contents($file);");
 $tempfile = wp_tempnam( $file );
 $temp = fopen($tempfile, 'w');
 if ( ! $temp )
 return false;
 fwrite($temp, $contents);
 fclose($temp);
 $ret = ssh2_scp_send($this->link, $tempfile, $file, $this->permission);
 unlink($tempfile);
 return $ret;
 }
 }}}


 The downside to this simplicity is that it doesn't bloody work on my
 system.
 I'm just about stumped now, and I'm ready to cry uncle. Can anyone, at
 all, make heads or tails of what the hell is going on?

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/10195>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list