WP_Filesystem_SSH2::run_command( string $command, bool $returnbool = false )
Description Description
Parameters Parameters
- $command
-
(string) (Required)
- $returnbool
-
(bool) (Optional)
Default value: false
Return Return
(bool|string) True on success, false on failure. String if the command was executed, $returnbool
is false (default), and data from the resulting stream was retrieved.
Source Source
File: wp-admin/includes/class-wp-filesystem-ssh2.php
public function run_command( $command, $returnbool = false ) { if ( ! $this->link ) return false; if ( ! ($stream = ssh2_exec($this->link, $command)) ) { $this->errors->add( 'command', /* translators: %s: command */ sprintf( __( 'Unable to perform command: %s'), $command ) ); } else { stream_set_blocking( $stream, true ); stream_set_timeout( $stream, FS_TIMEOUT ); $data = stream_get_contents( $stream ); fclose( $stream ); if ( $returnbool ) return ( $data === false ) ? false : '' != trim($data); else return $data; } return false; }
Expand full source code Collapse full source code View on Trac