Support » Fixing WordPress » WordPress 2.8 autoupdates over SSH broken for me

  • After upgrading, 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 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_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_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

    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 = '' ) {
    $tempfile = wp_tempnam( $file );
    $temp = fopen($tempfile, 'w');
    if ( ! $temp )
    return false;
    fwrite($temp, $contents);
    $ret = ssh2_scp_send($this->link, $tempfile, $file, $this->permission);
    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?

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘WordPress 2.8 autoupdates over SSH broken for me’ is closed to new replies.