ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
phpseclib\Net\SFTP\Stream Class Reference
+ Collaboration diagram for phpseclib\Net\SFTP\Stream:

Public Member Functions

 __construct ()
 The Constructor. More...
 
 _parse_path ($path)
 Path Parser. More...
 
 _stream_open ($path, $mode, $options, &$opened_path)
 Opens file or URL. More...
 
 _stream_read ($count)
 Read from stream. More...
 
 _stream_write ($data)
 Write to stream. More...
 
 _stream_tell ()
 Retrieve the current position of a stream. More...
 
 _stream_eof ()
 Tests for end-of-file on a file pointer. More...
 
 _stream_seek ($offset, $whence)
 Seeks to specific location in a stream. More...
 
 _stream_metadata ($path, $option, $var)
 Change stream options. More...
 
 _stream_cast ($cast_as)
 Retrieve the underlaying resource. More...
 
 _stream_lock ($operation)
 Advisory file locking. More...
 
 _rename ($path_from, $path_to)
 Renames a file or directory. More...
 
 _dir_opendir ($path, $options)
 Open directory handle. More...
 
 _dir_readdir ()
 Read entry from directory handle. More...
 
 _dir_rewinddir ()
 Rewind directory handle. More...
 
 _dir_closedir ()
 Close directory handle. More...
 
 _mkdir ($path, $mode, $options)
 Create a directory. More...
 
 _rmdir ($path, $options)
 Removes a directory. More...
 
 _stream_flush ()
 Flushes the output. More...
 
 _stream_stat ()
 Retrieve information about a file resource. More...
 
 _unlink ($path)
 Delete a file. More...
 
 _url_stat ($path, $flags)
 Retrieve information about a file. More...
 
 _stream_truncate ($new_size)
 Truncate stream. More...
 
 _stream_set_option ($option, $arg1, $arg2)
 Change stream options. More...
 
 _stream_close ()
 Close an resource. More...
 
 __call ($name, $arguments)
 __call Magic Method More...
 

Static Public Member Functions

static register ($protocol='sftp')
 Registers this class as a URL wrapper. More...
 

Data Fields

 $sftp
 
 $path
 
 $mode
 
 $pos
 
 $size
 
 $entries
 
 $eof
 
 $context
 
 $notification
 

Static Public Attributes

static $instances
 

Detailed Description

Definition at line 30 of file Stream.php.

Constructor & Destructor Documentation

◆ __construct()

phpseclib\Net\SFTP\Stream::__construct ( )

The Constructor.

public

Definition at line 135 of file Stream.php.

136  {
137  if (defined('NET_SFTP_STREAM_LOGGING')) {
138  echo "__construct()\r\n";
139  }
140  }

Member Function Documentation

◆ __call()

phpseclib\Net\SFTP\Stream::__call (   $name,
  $arguments 
)

__call Magic Method

When you're utilizing an SFTP stream you're not calling the methods in this class directly - PHP is calling them for you. Which kinda begs the question... what methods is PHP calling and what parameters is it passing to them? This function lets you figure that out.

If NET_SFTP_STREAM_LOGGING is defined all calls will be output on the screen and then (regardless of whether or not NET_SFTP_STREAM_LOGGING is enabled) the parameters will be passed through to the appropriate method.

Parameters
string
array
Returns
mixed public

Definition at line 776 of file Stream.php.

References $i, and $name.

777  {
778  if (defined('NET_SFTP_STREAM_LOGGING')) {
779  echo $name . '(';
780  $last = count($arguments) - 1;
781  foreach ($arguments as $i => $argument) {
782  var_export($argument);
783  if ($i != $last) {
784  echo ',';
785  }
786  }
787  echo ")\r\n";
788  }
789  $name = '_' . $name;
790  if (!method_exists($this, $name)) {
791  return false;
792  }
793  return call_user_func_array(array($this, $name), $arguments);
794  }
$i
Definition: disco.tpl.php:19

◆ _dir_closedir()

phpseclib\Net\SFTP\Stream::_dir_closedir ( )

Close directory handle.

Returns
bool public

Definition at line 594 of file Stream.php.

595  {
596  return true;
597  }

◆ _dir_opendir()

phpseclib\Net\SFTP\Stream::_dir_opendir (   $path,
  $options 
)

Open directory handle.

The only $options is "whether or not to enforce safe_mode (0x04)". Since safe mode was deprecated in 5.3 and removed in 5.4 I'm just going to ignore it.

Also, nlist() is the best that this function is realistically going to be able to do. When an SFTP client sends a SSH_FXP_READDIR packet you don't generally get info on just one file but on multiple files. Quoting the SFTP specs:

The SSH_FXP_NAME response has the following format:

uint32     id
uint32     count
repeats count times:
        string     filename
        string     longname
        ATTRS      attrs
Parameters
string$path
int$options
Returns
bool public

Definition at line 551 of file Stream.php.

References phpseclib\Net\SFTP\Stream\_parse_path().

552  {
553  $path = $this->_parse_path($path);
554  if ($path === false) {
555  return false;
556  }
557  $this->pos = 0;
558  $this->entries = $this->sftp->nlist($path);
559  return $this->entries !== false;
560  }
_parse_path($path)
Path Parser.
Definition: Stream.php:154
+ Here is the call graph for this function:

◆ _dir_readdir()

phpseclib\Net\SFTP\Stream::_dir_readdir ( )

Read entry from directory handle.

Returns
mixed public

Definition at line 568 of file Stream.php.

569  {
570  if (isset($this->entries[$this->pos])) {
571  return $this->entries[$this->pos++];
572  }
573  return false;
574  }

◆ _dir_rewinddir()

phpseclib\Net\SFTP\Stream::_dir_rewinddir ( )

Rewind directory handle.

Returns
bool public

Definition at line 582 of file Stream.php.

583  {
584  $this->pos = 0;
585  return true;
586  }

◆ _mkdir()

phpseclib\Net\SFTP\Stream::_mkdir (   $path,
  $mode,
  $options 
)

Create a directory.

Only valid $options is STREAM_MKDIR_RECURSIVE

Parameters
string$path
int$mode
int$options
Returns
bool public

Definition at line 610 of file Stream.php.

References PHPMailer\PHPMailer\$options, and phpseclib\Net\SFTP\Stream\_parse_path().

611  {
612  $path = $this->_parse_path($path);
613  if ($path === false) {
614  return false;
615  }
616 
617  return $this->sftp->mkdir($path, $mode, $options & STREAM_MKDIR_RECURSIVE);
618  }
_parse_path($path)
Path Parser.
Definition: Stream.php:154
+ Here is the call graph for this function:

◆ _parse_path()

phpseclib\Net\SFTP\Stream::_parse_path (   $path)

Path Parser.

Extract a path from a URI and actually connect to an SSH server if appropriate

If "notification" is set as a context parameter the message code for successful login is NET_SSH2_MSG_USERAUTH_SUCCESS. For a failed login it's NET_SSH2_MSG_USERAUTH_FAILURE.

Parameters
string$path
Returns
string private

Definition at line 154 of file Stream.php.

References phpseclib\Net\SSH2\$host, $pass, phpseclib\Net\SFTP\Stream\$path, phpseclib\Net\SSH2\$port, $query, phpseclib\Net\SFTP\Stream\$sftp, $user, and notification().

Referenced by phpseclib\Net\SFTP\Stream\_dir_opendir(), phpseclib\Net\SFTP\Stream\_mkdir(), phpseclib\Net\SFTP\Stream\_rename(), phpseclib\Net\SFTP\Stream\_rmdir(), phpseclib\Net\SFTP\Stream\_stream_metadata(), phpseclib\Net\SFTP\Stream\_stream_open(), phpseclib\Net\SFTP\Stream\_unlink(), and phpseclib\Net\SFTP\Stream\_url_stat().

155  {
156  $orig = $path;
157  extract(parse_url($path) + array('port' => 22));
158  if (isset($query)) {
159  $path.= '?' . $query;
160  } elseif (preg_match('/(\?|\?#)$/', $orig)) {
161  $path.= '?';
162  }
163  if (isset($fragment)) {
164  $path.= '#' . $fragment;
165  } elseif ($orig[strlen($orig) - 1] == '#') {
166  $path.= '#';
167  }
168 
169  if (!isset($host)) {
170  return false;
171  }
172 
173  if (isset($this->context)) {
174  $context = stream_context_get_params($this->context);
175  if (isset($context['notification'])) {
176  $this->notification = $context['notification'];
177  }
178  }
179 
180  if ($host[0] == '$') {
181  $host = substr($host, 1);
182  global $$host;
183  if (($$host instanceof SFTP) === false) {
184  return false;
185  }
186  $this->sftp = $$host;
187  } else {
188  if (isset($this->context)) {
189  $context = stream_context_get_options($this->context);
190  }
191  if (isset($context[$scheme]['session'])) {
192  $sftp = $context[$scheme]['session'];
193  }
194  if (isset($context[$scheme]['sftp'])) {
195  $sftp = $context[$scheme]['sftp'];
196  }
197  if (isset($sftp) && $sftp instanceof SFTP) {
198  $this->sftp = $sftp;
199  return $path;
200  }
201  if (isset($context[$scheme]['username'])) {
202  $user = $context[$scheme]['username'];
203  }
204  if (isset($context[$scheme]['password'])) {
205  $pass = $context[$scheme]['password'];
206  }
207  if (isset($context[$scheme]['privkey']) && $context[$scheme]['privkey'] instanceof RSA) {
208  $pass = $context[$scheme]['privkey'];
209  }
210 
211  if (!isset($user) || !isset($pass)) {
212  return false;
213  }
214 
215  // casting $pass to a string is necessary in the event that it's a \phpseclib\Crypt\RSA object
216  if (isset(self::$instances[$host][$port][$user][(string) $pass])) {
217  $this->sftp = self::$instances[$host][$port][$user][(string) $pass];
218  } else {
219  $this->sftp = new SFTP($host, $port);
220  $this->sftp->disableStatCache();
221  if (isset($this->notification) && is_callable($this->notification)) {
222  /* if !is_callable($this->notification) we could do this:
223 
224  user_error('fopen(): failed to call user notifier', E_USER_WARNING);
225 
226  the ftp wrapper gives errors like that when the notifier isn't callable.
227  i've opted not to do that, however, since the ftp wrapper gives the line
228  on which the fopen occurred as the line number - not the line that the
229  user_error is on.
230  */
231  call_user_func($this->notification, STREAM_NOTIFY_CONNECT, STREAM_NOTIFY_SEVERITY_INFO, '', 0, 0, 0);
232  call_user_func($this->notification, STREAM_NOTIFY_AUTH_REQUIRED, STREAM_NOTIFY_SEVERITY_INFO, '', 0, 0, 0);
233  if (!$this->sftp->login($user, $pass)) {
234  call_user_func($this->notification, STREAM_NOTIFY_AUTH_RESULT, STREAM_NOTIFY_SEVERITY_ERR, 'Login Failure', NET_SSH2_MSG_USERAUTH_FAILURE, 0, 0);
235  return false;
236  }
237  call_user_func($this->notification, STREAM_NOTIFY_AUTH_RESULT, STREAM_NOTIFY_SEVERITY_INFO, 'Login Success', NET_SSH2_MSG_USERAUTH_SUCCESS, 0, 0);
238  } else {
239  if (!$this->sftp->login($user, $pass)) {
240  return false;
241  }
242  }
243  self::$instances[$host][$port][$user][(string) $pass] = $this->sftp;
244  }
245  }
246 
247  return $path;
248  }
Pure-PHP PKCS#1 compliant implementation of RSA.
SFTP Stream Wrapper.
notification()
Definition: notification.php:2
$query
$user
Definition: migrateto20.php:57
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _rename()

phpseclib\Net\SFTP\Stream::_rename (   $path_from,
  $path_to 
)

Renames a file or directory.

Attempts to rename oldname to newname, moving it between directories if necessary. If newname exists, it will be overwritten. This is a departure from what does.

Parameters
string$path_from
string$path_to
Returns
bool public

Definition at line 499 of file Stream.php.

References phpseclib\Net\SFTP\Stream\_parse_path().

500  {
501  $path1 = parse_url($path_from);
502  $path2 = parse_url($path_to);
503  unset($path1['path'], $path2['path']);
504  if ($path1 != $path2) {
505  return false;
506  }
507 
508  $path_from = $this->_parse_path($path_from);
509  $path_to = parse_url($path_to);
510  if ($path_from === false) {
511  return false;
512  }
513 
514  $path_to = $path_to['path']; // the $component part of parse_url() was added in PHP 5.1.2
515  // "It is an error if there already exists a file with the name specified by newpath."
516  // -- http://tools.ietf.org/html/draft-ietf-secsh-filexfer-02#section-6.5
517  if (!$this->sftp->rename($path_from, $path_to)) {
518  if ($this->sftp->stat($path_to)) {
519  return $this->sftp->delete($path_to, true) && $this->sftp->rename($path_from, $path_to);
520  }
521  return false;
522  }
523 
524  return true;
525  }
_parse_path($path)
Path Parser.
Definition: Stream.php:154
+ Here is the call graph for this function:

◆ _rmdir()

phpseclib\Net\SFTP\Stream::_rmdir (   $path,
  $options 
)

Removes a directory.

Only valid $options is STREAM_MKDIR_RECURSIVE per http://php.net/streamwrapper.rmdir, however, http://php.net/rmdir does not have a $recursive parameter as mkdir() does so I don't know how STREAM_MKDIR_RECURSIVE is supposed to be set. Also, when I try it out with rmdir() I get 8 as $options. What does 8 correspond to?

Parameters
string$path
int$mode
int$options
Returns
bool public

Definition at line 634 of file Stream.php.

References phpseclib\Net\SFTP\Stream\_parse_path().

635  {
636  $path = $this->_parse_path($path);
637  if ($path === false) {
638  return false;
639  }
640 
641  return $this->sftp->rmdir($path);
642  }
_parse_path($path)
Path Parser.
Definition: Stream.php:154
+ Here is the call graph for this function:

◆ _stream_cast()

phpseclib\Net\SFTP\Stream::_stream_cast (   $cast_as)

Retrieve the underlaying resource.

Parameters
int$cast_as
Returns
resource public

Definition at line 470 of file Stream.php.

471  {
472  return $this->sftp->fsock;
473  }

◆ _stream_close()

phpseclib\Net\SFTP\Stream::_stream_close ( )

Close an resource.

public

Definition at line 757 of file Stream.php.

758  {
759  }

◆ _stream_eof()

phpseclib\Net\SFTP\Stream::_stream_eof ( )

Tests for end-of-file on a file pointer.

In my testing there are four classes functions that normally effect the pointer: fseek, fputs / fwrite, fgets / fread and ftruncate.

Only fgets / fread, however, results in feof() returning true. do fputs($fp, 'aaa') on a blank file and feof() will return false. do fread($fp, 1) and feof() will then return true. do fseek($fp, 10) on ablank file and feof() will return false. do fread($fp, 1) and feof() will then return true.

Returns
bool public

Definition at line 396 of file Stream.php.

References phpseclib\Net\SFTP\Stream\$eof.

397  {
398  return $this->eof;
399  }

◆ _stream_flush()

phpseclib\Net\SFTP\Stream::_stream_flush ( )

Flushes the output.

See http://php.net/fflush. Always returns true because doesn't cache stuff before writing

Returns
bool public

Definition at line 652 of file Stream.php.

653  {
654  return true;
655  }

◆ _stream_lock()

phpseclib\Net\SFTP\Stream::_stream_lock (   $operation)

Advisory file locking.

Parameters
int$operation
Returns
bool public

Definition at line 482 of file Stream.php.

483  {
484  return false;
485  }

◆ _stream_metadata()

phpseclib\Net\SFTP\Stream::_stream_metadata (   $path,
  $option,
  $var 
)

Change stream options.

Parameters
string$path
int$option
mixed$var
Returns
bool public

Definition at line 438 of file Stream.php.

References phpseclib\Net\SFTP\Stream\_parse_path().

439  {
440  $path = $this->_parse_path($path);
441  if ($path === false) {
442  return false;
443  }
444 
445  // stream_metadata was introduced in PHP 5.4.0 but as of 5.4.11 the constants haven't been defined
446  // see http://www.php.net/streamwrapper.stream-metadata and https://bugs.php.net/64246
447  // and https://github.com/php/php-src/blob/master/main/php_streams.h#L592
448  switch ($option) {
449  case 1: // PHP_STREAM_META_TOUCH
450  return $this->sftp->touch($path, $var[0], $var[1]);
451  case 2: // PHP_STREAM_OWNER_NAME
452  case 3: // PHP_STREAM_GROUP_NAME
453  return false;
454  case 4: // PHP_STREAM_META_OWNER
455  return $this->sftp->chown($path, $var);
456  case 5: // PHP_STREAM_META_GROUP
457  return $this->sftp->chgrp($path, $var);
458  case 6: // PHP_STREAM_META_ACCESS
459  return $this->sftp->chmod($path, $var) !== false;
460  }
461  }
_parse_path($path)
Path Parser.
Definition: Stream.php:154
+ Here is the call graph for this function:

◆ _stream_open()

phpseclib\Net\SFTP\Stream::_stream_open (   $path,
  $mode,
  $options,
$opened_path 
)

Opens file or URL.

Parameters
string$path
string$mode
int$options
string$opened_path
Returns
bool public

Definition at line 260 of file Stream.php.

References phpseclib\Net\SFTP\Stream\$path, phpseclib\Net\SFTP\Stream\$size, phpseclib\Net\SFTP\Stream\_parse_path(), and phpseclib\Net\SFTP\size().

261  {
262  $path = $this->_parse_path($path);
263 
264  if ($path === false) {
265  return false;
266  }
267  $this->path = $path;
268 
269  $this->size = $this->sftp->size($path);
270  $this->mode = preg_replace('#[bt]$#', '', $mode);
271  $this->eof = false;
272 
273  if ($this->size === false) {
274  if ($this->mode[0] == 'r') {
275  return false;
276  } else {
277  $this->sftp->touch($path);
278  $this->size = 0;
279  }
280  } else {
281  switch ($this->mode[0]) {
282  case 'x':
283  return false;
284  case 'w':
285  $this->sftp->truncate($path, 0);
286  $this->size = 0;
287  }
288  }
289 
290  $this->pos = $this->mode[0] != 'a' ? 0 : $this->size;
291 
292  return true;
293  }
_parse_path($path)
Path Parser.
Definition: Stream.php:154
size($filename)
Returns the file size, in bytes, or false, on failure.
Definition: SFTP.php:1027
+ Here is the call graph for this function:

◆ _stream_read()

phpseclib\Net\SFTP\Stream::_stream_read (   $count)

Read from stream.

Parameters
int$count
Returns
mixed public

Definition at line 302 of file Stream.php.

References $result, notification(), and phpseclib\Net\SFTP\size().

303  {
304  switch ($this->mode) {
305  case 'w':
306  case 'a':
307  case 'x':
308  case 'c':
309  return false;
310  }
311 
312  // commented out because some files - eg. /dev/urandom - will say their size is 0 when in fact it's kinda infinite
313  //if ($this->pos >= $this->size) {
314  // $this->eof = true;
315  // return false;
316  //}
317 
318  $result = $this->sftp->get($this->path, false, $this->pos, $count);
319  if (isset($this->notification) && is_callable($this->notification)) {
320  if ($result === false) {
321  call_user_func($this->notification, STREAM_NOTIFY_FAILURE, STREAM_NOTIFY_SEVERITY_ERR, $this->sftp->getLastSFTPError(), NET_SFTP_OPEN, 0, 0);
322  return 0;
323  }
324  // seems that PHP calls stream_read in 8k chunks
325  call_user_func($this->notification, STREAM_NOTIFY_PROGRESS, STREAM_NOTIFY_SEVERITY_INFO, '', 0, strlen($result), $this->size);
326  }
327 
328  if (empty($result)) { // ie. false or empty string
329  $this->eof = true;
330  return false;
331  }
332  $this->pos+= strlen($result);
333 
334  return $result;
335  }
$result
size($filename)
Returns the file size, in bytes, or false, on failure.
Definition: SFTP.php:1027
notification()
Definition: notification.php:2
+ Here is the call graph for this function:

◆ _stream_seek()

phpseclib\Net\SFTP\Stream::_stream_seek (   $offset,
  $whence 
)

Seeks to specific location in a stream.

Parameters
int$offset
int$whence
Returns
bool public

Definition at line 409 of file Stream.php.

References phpseclib\Net\SFTP\Stream\$pos, phpseclib\Net\SFTP\Stream\$size, and phpseclib\Net\SFTP\size().

410  {
411  switch ($whence) {
412  case SEEK_SET:
413  if ($offset >= $this->size || $offset < 0) {
414  return false;
415  }
416  break;
417  case SEEK_CUR:
418  $offset+= $this->pos;
419  break;
420  case SEEK_END:
421  $offset+= $this->size;
422  }
423 
424  $this->pos = $offset;
425  $this->eof = false;
426  return true;
427  }
size($filename)
Returns the file size, in bytes, or false, on failure.
Definition: SFTP.php:1027
+ Here is the call graph for this function:

◆ _stream_set_option()

phpseclib\Net\SFTP\Stream::_stream_set_option (   $option,
  $arg1,
  $arg2 
)

Change stream options.

STREAM_OPTION_WRITE_BUFFER isn't supported for the same reason stream_flush isn't. The other two aren't supported because of limitations in .

Parameters
int$option
int$arg1
int$arg2
Returns
bool public

Definition at line 747 of file Stream.php.

748  {
749  return false;
750  }

◆ _stream_stat()

phpseclib\Net\SFTP\Stream::_stream_stat ( )

Retrieve information about a file resource.

Returns
mixed public

Definition at line 663 of file Stream.php.

References $results.

664  {
665  $results = $this->sftp->stat($this->path);
666  if ($results === false) {
667  return false;
668  }
669  return $results;
670  }
$results
Definition: svg-scanner.php:47

◆ _stream_tell()

phpseclib\Net\SFTP\Stream::_stream_tell ( )

Retrieve the current position of a stream.

Returns
int public

Definition at line 378 of file Stream.php.

References phpseclib\Net\SFTP\Stream\$pos.

379  {
380  return $this->pos;
381  }

◆ _stream_truncate()

phpseclib\Net\SFTP\Stream::_stream_truncate (   $new_size)

Truncate stream.

Parameters
int$new_size
Returns
bool public

Definition at line 723 of file Stream.php.

References phpseclib\Net\SFTP\size().

724  {
725  if (!$this->sftp->truncate($this->path, $new_size)) {
726  return false;
727  }
728 
729  $this->eof = false;
730  $this->size = $new_size;
731 
732  return true;
733  }
size($filename)
Returns the file size, in bytes, or false, on failure.
Definition: SFTP.php:1027
+ Here is the call graph for this function:

◆ _stream_write()

phpseclib\Net\SFTP\Stream::_stream_write (   $data)

Write to stream.

Parameters
string$data
Returns
mixed public

Definition at line 344 of file Stream.php.

References $data, phpseclib\Net\SFTP\Stream\$pos, $result, notification(), phpseclib\Net\SFTP\size(), and phpseclib\Net\SFTP\SOURCE_STRING.

345  {
346  switch ($this->mode) {
347  case 'r':
348  return false;
349  }
350 
351  $result = $this->sftp->put($this->path, $data, SFTP::SOURCE_STRING, $this->pos);
352  if (isset($this->notification) && is_callable($this->notification)) {
353  if (!$result) {
354  call_user_func($this->notification, STREAM_NOTIFY_FAILURE, STREAM_NOTIFY_SEVERITY_ERR, $this->sftp->getLastSFTPError(), NET_SFTP_OPEN, 0, 0);
355  return 0;
356  }
357  // seems that PHP splits up strings into 8k blocks before calling stream_write
358  call_user_func($this->notification, STREAM_NOTIFY_PROGRESS, STREAM_NOTIFY_SEVERITY_INFO, '', 0, strlen($data), strlen($data));
359  }
360 
361  if ($result === false) {
362  return false;
363  }
364  $this->pos+= strlen($data);
365  if ($this->pos > $this->size) {
366  $this->size = $this->pos;
367  }
368  $this->eof = false;
369  return strlen($data);
370  }
$result
const SOURCE_STRING
Reads data from a string.
Definition: SFTP.php:74
size($filename)
Returns the file size, in bytes, or false, on failure.
Definition: SFTP.php:1027
notification()
Definition: notification.php:2
$data
Definition: bench.php:6
+ Here is the call graph for this function:

◆ _unlink()

phpseclib\Net\SFTP\Stream::_unlink (   $path)

Delete a file.

Parameters
string$path
Returns
bool public

Definition at line 679 of file Stream.php.

References phpseclib\Net\SFTP\Stream\_parse_path().

680  {
681  $path = $this->_parse_path($path);
682  if ($path === false) {
683  return false;
684  }
685 
686  return $this->sftp->delete($path, false);
687  }
_parse_path($path)
Path Parser.
Definition: Stream.php:154
+ Here is the call graph for this function:

◆ _url_stat()

phpseclib\Net\SFTP\Stream::_url_stat (   $path,
  $flags 
)

Retrieve information about a file.

Ignores the STREAM_URL_STAT_QUIET flag because the entirety of is quiet by default might be worthwhile to reconstruct bits 12-16 (ie. the file type) if mode doesn't have them but we'll cross that bridge when and if it's reached

Parameters
string$path
int$flags
Returns
mixed public

Definition at line 701 of file Stream.php.

References $results, and phpseclib\Net\SFTP\Stream\_parse_path().

702  {
703  $path = $this->_parse_path($path);
704  if ($path === false) {
705  return false;
706  }
707 
708  $results = $flags & STREAM_URL_STAT_LINK ? $this->sftp->lstat($path) : $this->sftp->stat($path);
709  if ($results === false) {
710  return false;
711  }
712 
713  return $results;
714  }
_parse_path($path)
Path Parser.
Definition: Stream.php:154
$results
Definition: svg-scanner.php:47
+ Here is the call graph for this function:

◆ register()

static phpseclib\Net\SFTP\Stream::register (   $protocol = 'sftp')
static

Registers this class as a URL wrapper.

Parameters
string$protocolThe wrapper name to be registered.
Returns
bool True on success, false otherwise. public

Definition at line 122 of file Stream.php.

References GuzzleHttp\Psr7\$protocol.

123  {
124  if (in_array($protocol, stream_get_wrappers(), true)) {
125  return false;
126  }
127  return stream_wrapper_register($protocol, get_called_class());
128  }

Field Documentation

◆ $context

phpseclib\Net\SFTP\Stream::$context

Definition at line 105 of file Stream.php.

◆ $entries

phpseclib\Net\SFTP\Stream::$entries

Definition at line 87 of file Stream.php.

◆ $eof

phpseclib\Net\SFTP\Stream::$eof

Definition at line 95 of file Stream.php.

Referenced by phpseclib\Net\SFTP\Stream\_stream_eof().

◆ $instances

phpseclib\Net\SFTP\Stream::$instances
static

Definition at line 39 of file Stream.php.

◆ $mode

phpseclib\Net\SFTP\Stream::$mode

Definition at line 63 of file Stream.php.

◆ $notification

phpseclib\Net\SFTP\Stream::$notification

Definition at line 113 of file Stream.php.

◆ $path

phpseclib\Net\SFTP\Stream::$path

◆ $pos

◆ $sftp

phpseclib\Net\SFTP\Stream::$sftp

Definition at line 47 of file Stream.php.

Referenced by phpseclib\Net\SFTP\Stream\_parse_path().

◆ $size

phpseclib\Net\SFTP\Stream::$size

The documentation for this class was generated from the following file: