Opened 8 years ago
#40195 new defect (bug)
No provision to set paths for sftp (ssh2)
Reported by: | fsrs | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | 4.7.2 |
Component: | Filesystem API | Keywords: | |
Focuses: | Cc: |
Description
I have a server which has different paths for the web server verses when accessed via sftp and consequently updates fail with "Unable to locate WordPress content directory (wp-content)."
According to this page https://codex.wordpress.org/Editing%20wp-config.php#Enabling_SSH_Upgrade_Access there are 3 options for this exact purpose: FTP_BASE, FTP_CONTENT_DIR, FTP_PLUGIN_DIR.
Setting these has no affect.
This is confirmed by turning on debug and the following error is generated:
"Installation failed: Looking for /usr/local/www/+++++/www/wp-content/plugins in /"
The "wp-admin/includes/class-wp-filesystem-base.php" file reveals the find_folder function only processes the overrides for ftp services.
public function find_folder( $folder ) { if ( isset( $this->cache[ $folder ] ) ) return $this->cache[ $folder ]; if ( stripos($this->method, 'ftp') !== false ) { $constant_overrides = array( 'FTP_BASE' => ABSPATH, 'FTP_CONTENT_DIR' => WP_CONTENT_DIR, 'FTP_PLUGIN_DIR' => WP_PLUGIN_DIR, 'FTP_LANG_DIR' => WP_LANG_DIR );
Seems to be a strange requirement on the ssh2 method that the paths must align exactly with the web server so I consider this a bug. Others may consider it an enhancement in which case it would be a good idea if the codex entry made it clear only ftp access methods support configurable paths (ssh must align with the webserver).