public $sftp_link;
public $keys = false;
- public function __construct($opt='') {
+ /**
+ *
+ * @param array $opt
+ */
+ public function __construct( $opt = '' ) {
$this->method = 'ssh2';
$this->errors = new WP_Error();
} else {
$this->options['password'] = $opt['password'];
}
-
}
+ /**
+ *
+ * @return bool
+ */
public function connect() {
if ( ! $this->keys ) {
$this->link = @ssh2_connect($this->options['hostname'], $this->options['port']);
* @param bool $returnbool
* @return bool|string
*/
- public function run_command( $command, $returnbool = false) {
-
+ public function run_command( $command, $returnbool = false ) {
if ( ! $this->link )
return false;
}
/**
- * @param string $file
- * @param string $contents
+ * @param string $file
+ * @param string $contents
* @param bool|int $mode
* @return bool
*/
return true;
}
+ /**
+ *
+ * @return bool
+ */
public function cwd() {
- $cwd = $this->run_command('pwd');
+ $cwd = ssh2_sftp_realpath( $this->sftp_link, '.' );
if ( $cwd ) {
$cwd = trailingslashit( trim( $cwd ) );
}
/**
* @param string $file
* @param string $group
- * @param bool $recursive
+ * @param bool $recursive
+ *
+ * @return bool
*/
public function chgrp($file, $group, $recursive = false ) {
if ( ! $this->exists($file) )
/**
* @param string $file
- * @param int $mode
- * @param bool $recursive
+ * @param int $mode
+ * @param bool $recursive
* @return bool|string
*/
public function chmod($file, $mode = false, $recursive = false) {
}
/**
- * @param string $source
- * @param string $destination
- * @param bool $overwrite
+ * @param string $source
+ * @param string $destination
+ * @param bool $overwrite
* @param int|bool $mode
* @return bool
*/
/**
* @param string $source
* @param string $destination
- * @param bool $overwrite
+ * @param bool $overwrite
* @return bool
*/
public function move($source, $destination, $overwrite = false) {
}
/**
- * @param string $file
- * @param bool $recursive
+ * @param string $file
+ * @param bool $recursive
* @param string|bool $type
* @return bool
*/
/**
* @param string $file
- * @param int $time
- * @param int $atime
+ * @param int $time
+ * @param int $atime
*/
public function touch($file, $time = 0, $atime = 0) {
//Not implemented.
/**
* @param string $path
- * @param mixed $chmod
- * @param mixed $chown
- * @param mixed $chgrp
+ * @param mixed $chmod
+ * @param mixed $chown
+ * @param mixed $chgrp
* @return bool
*/
public function mkdir($path, $chmod = false, $chown = false, $chgrp = false) {
/**
* @param string $path
- * @param bool $recursive
+ * @param bool $recursive
* @return bool
*/
public function rmdir($path, $recursive = false) {
/**
* @param string $path
- * @param bool $include_hidden
- * @param bool $recursive
+ * @param bool $include_hidden
+ * @param bool $recursive
* @return bool|array
*/
public function dirlist($path, $include_hidden = true, $recursive = false) {