Parameters
$command
stringrequired$returnbool
booloptionalDefault:
false
Source
public function run_command( $command, $returnbool = false ) {
if ( ! $this->link ) {
return false;
}
$stream = ssh2_exec( $this->link, $command );
if ( ! $stream ) {
$this->errors->add(
'command',
sprintf(
/* translators: %s: Command. */
__( '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 ( false === $data ) ? false : '' !== trim( $data );
} else {
return $data;
}
}
return false;
}
Changelog
Version | Description |
---|---|
2.7.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.