Opened 4 years ago
Last modified 4 years ago
#55469 new enhancement
WP_Filesystem_SSH2::chmod() should use ssh2_sftp_chmod()
| Reported by: | pbiron | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Awaiting Review |
| Component: | Filesystem API | Version: | |
| Severity: | normal | Keywords: | has-patch needs-testing |
| Cc: | Focuses: |
Description
WP_Filesystem_SSH2::chmod() currently uses ::run_command( sprintf( 'chmod %o %s', $mode, escapeshellarg( $file ) ), true ) (which calls ssh2_exec()). It has essentially been this way since WP_Filesystem_SS2 was introduced in [8812].
However, some sftp servers do not allow ssh2_exec() to be run, generating PHP warnings such as:
PHP Warning: ssh2_exec(): Unable to request command execution on remote host
and on those severs all calls to WP_Filesystem_SSH2::chmod() basically become noops.
Luckily, starting with version 0.12, the ssh2 extension introduced ssh2_sftp_chmod(), and WP_Filesystem_SSH2::chmod() should be changed to use it.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Trac ticket: #55469