Joomla CMS  4.2.2
Documentation des API du CMS Joomla en version 4.2.2
Référence de la classe Stream

Fonctions membres publiques

 __construct ()
 
 __call ($name, $arguments)
 

Fonctions membres publiques statiques

static register ($protocol='sftp')
 

Champs de données

 $context
 

Attributs publics statiques

static $instances
 

Fonctions membres protégées

 parse_path ($path)
 

Fonctions membres privées

 _stream_open ($path, $mode, $options, &$opened_path)
 
 _stream_read ($count)
 
 _stream_write ($data)
 
 _stream_tell ()
 
 _stream_eof ()
 
 _stream_seek ($offset, $whence)
 
 _stream_metadata ($path, $option, $var)
 
 _stream_cast ($cast_as)
 
 _stream_lock ($operation)
 
 _rename ($path_from, $path_to)
 
 _dir_opendir ($path, $options)
 
 _dir_readdir ()
 
 _dir_rewinddir ()
 
 _dir_closedir ()
 
 _mkdir ($path, $mode, $options)
 
 _rmdir ($path, $options)
 
 _stream_flush ()
 
 _stream_stat ()
 
 _unlink ($path)
 
 _url_stat ($path, $flags)
 
 _stream_truncate ($new_size)
 
 _stream_set_option ($option, $arg1, $arg2)
 
 _stream_close ()
 

Attributs privés

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

Documentation des constructeurs et destructeur

◆ __construct()

__construct ( )

The Constructor

public

Documentation des fonctions membres

◆ __call()

__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.

Paramètres
string$name
array$arguments
Renvoie
mixed public

Références $i, $last, $name, et $this.

◆ _dir_closedir()

_dir_closedir ( )
private

Close directory handle

Renvoie
bool public

◆ _dir_opendir()

_dir_opendir (   $path,
  $options 
)
private

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
Paramètres
string$path
int$options
Renvoie
bool public

Références Stream\$path, et Stream\parse_path().

◆ _dir_readdir()

_dir_readdir ( )
private

Read entry from directory handle

Renvoie
mixed public

◆ _dir_rewinddir()

_dir_rewinddir ( )
private

Rewind directory handle

Renvoie
bool public

◆ _mkdir()

_mkdir (   $path,
  $mode,
  $options 
)
private

Create a directory

Only valid $options is STREAM_MKDIR_RECURSIVE

Paramètres
string$path
int$mode
int$options
Renvoie
bool public

Références Stream\$mode, $options, Stream\$path, et Stream\parse_path().

◆ _rename()

_rename (   $path_from,
  $path_to 
)
private

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.

Paramètres
string$path_from
string$path_to
Renvoie
bool public

Références Stream\parse_path().

◆ _rmdir()

_rmdir (   $path,
  $options 
)
private

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?

Paramètres
string$path
int$options
Renvoie
bool public

Références Stream\$path, et Stream\parse_path().

◆ _stream_cast()

_stream_cast (   $cast_as)
private

Retrieve the underlaying resource

Paramètres
int$cast_as
Renvoie
resource public

◆ _stream_close()

_stream_close ( )
private

Close an resource

public

◆ _stream_eof()

_stream_eof ( )
private

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.

Renvoie
bool public

Références Stream\$eof.

◆ _stream_flush()

_stream_flush ( )
private

Flushes the output

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

Renvoie
bool public

◆ _stream_lock()

_stream_lock (   $operation)
private

Advisory file locking

Paramètres
int$operation
Renvoie
bool public

◆ _stream_metadata()

_stream_metadata (   $path,
  $option,
  $var 
)
private

Change stream options

Paramètres
string$path
int$option
mixed$var
Renvoie
bool public

Références $option, Stream\$path, null, et Stream\parse_path().

◆ _stream_open()

_stream_open (   $path,
  $mode,
  $options,
$opened_path 
)
private

Opens file or URL

Paramètres
string$path
string$mode
int$options
string$opened_path
Renvoie
bool public

Références Stream\$mode, Stream\$path, Stream\$size, Stream\parse_path(), et path.

◆ _stream_read()

_stream_read (   $count)
private

Read from stream

Paramètres
int$count
Renvoie
mixed public

Références $count, $result, et path.

◆ _stream_seek()

_stream_seek (   $offset,
  $whence 
)
private

Seeks to specific location in a stream

Paramètres
int$offset
int$whence
Renvoie
bool public

Références Joomla\Database\Query\$offset, Stream\$pos, et Stream\$size.

◆ _stream_set_option()

_stream_set_option (   $option,
  $arg1,
  $arg2 
)
private

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 .

Paramètres
int$option
int$arg1
int$arg2
Renvoie
bool public

◆ _stream_stat()

_stream_stat ( )
private

Retrieve information about a file resource

Renvoie
mixed public

Références $results, et path.

◆ _stream_tell()

_stream_tell ( )
private

Retrieve the current position of a stream

Renvoie
int public

Références Stream\$pos.

◆ _stream_truncate()

_stream_truncate (   $new_size)
private

Truncate stream

Paramètres
int$new_size
Renvoie
bool public

Références $this.

◆ _stream_write()

_stream_write (   $data)
private

Write to stream

Paramètres
string$data
Renvoie
int|false public

Références $data, Stream\$pos, $result, path, et SFTP\SOURCE_STRING.

◆ _unlink()

_unlink (   $path)
private

Delete a file

Paramètres
string$path
Renvoie
bool public

Références Stream\$path, et Stream\parse_path().

◆ _url_stat()

_url_stat (   $path,
  $flags 
)
private

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

Paramètres
string$path
int$flags
Renvoie
mixed public

Références Stream\$path, $results, et Stream\parse_path().

◆ parse_path()

parse_path (   $path)
protected

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.

Paramètres
string$path
Renvoie
string private

Références Stream\$context, SSH2\$host, Stream\$path, SSH2\$port, $query, Stream\$sftp, $user, elseif, et SSH2\getConnectionByResourceId().

Référencé par Stream\_dir_opendir(), Stream\_mkdir(), Stream\_rename(), Stream\_rmdir(), Stream\_stream_metadata(), Stream\_stream_open(), Stream\_unlink(), et Stream\_url_stat().

◆ register()

static register (   $protocol = 'sftp')
static

Registers this class as a URL wrapper.

Paramètres
string$protocolThe wrapper name to be registered.
Renvoie
bool True on success, false otherwise. public

Références Laminas\Diactoros\$protocol.

Documentation des champs

◆ $context

$context

Référencé par Stream\parse_path().

◆ $entries

$entries
private

◆ $eof

$eof
private

Référencé par Stream\_stream_eof().

◆ $instances

$instances
static

◆ $mode

$mode
private

Référencé par Stream\_mkdir(), et Stream\_stream_open().

◆ $notification

$notification
private

◆ $path

◆ $pos

◆ $sftp

$sftp
private

Référencé par Stream\parse_path().

◆ $size

$size
private

La documentation de cette classe a été générée à partir du fichier suivant :