Joomla CMS  4.2.2
Documentation des API du CMS Joomla en version 4.2.2
Référence de la classe SFTP
+ Graphe d'héritage de SFTP:

Fonctions membres publiques

 __construct ($host, $port=22, $timeout=10)
 
 disableStatCache ()
 
 enableStatCache ()
 
 clearStatCache ()
 
 enablePathCanonicalization ()
 
 disablePathCanonicalization ()
 
 enableArbitraryLengthPackets ()
 
 disableArbitraryLengthPackets ()
 
 pwd ()
 
 realpath ($path)
 
 chdir ($dir)
 
 nlist ($dir='.', $recursive=false)
 
 rawlist ($dir='.', $recursive=false)
 
 setListOrder (... $args)
 
 stat ($filename)
 
 lstat ($filename)
 
 truncate ($filename, $new_size)
 
 touch ($filename, $time=null, $atime=null)
 
 chown ($filename, $uid, $recursive=false)
 
 chgrp ($filename, $gid, $recursive=false)
 
 chmod ($mode, $filename, $recursive=false)
 
 readlink ($link)
 
 symlink ($target, $link)
 
 mkdir ($dir, $mode=-1, $recursive=false)
 
 rmdir ($dir)
 
 put ($remote_file, $data, $mode=self::SOURCE_STRING, $start=-1, $local_start=-1, $progressCallback=null)
 
 get ($remote_file, $local_file=false, $offset=0, $length=-1, $progressCallback=null)
 
 delete ($path, $recursive=true)
 
 file_exists ($path)
 
 is_dir ($path)
 
 is_file ($path)
 
 is_link ($path)
 
 is_readable ($path)
 
 is_writable ($path)
 
 is_writeable ($path)
 
 fileatime ($path)
 
 filemtime ($path)
 
 fileperms ($path)
 
 fileowner ($path)
 
 filegroup ($path)
 
 filesize ($path)
 
 filetype ($path)
 
 rename ($oldname, $newname)
 
 getSFTPLog ()
 
 getSFTPErrors ()
 
 getLastSFTPError ()
 
 getSupportedVersions ()
 
 getNegotiatedVersion ()
 
 setPreferredVersion ($version)
 
 enableDatePreservation ()
 
 disableDatePreservation ()
 
- Fonctions membres publiques hérités de SSH2
 sendIdentificationStringFirst ()
 
 sendIdentificationStringLast ()
 
 sendKEXINITFirst ()
 
 sendKEXINITLast ()
 
 login ($username,... $args)
 
 setTimeout ($timeout)
 
 setKeepAlive ($interval)
 
 getStdError ()
 
 exec ($command, callable $callback=null)
 
 requestAgentForwarding ()
 
 read ($expect='', $mode=self::READ_SIMPLE)
 
 write ($cmd)
 
 startSubsystem ($subsystem)
 
 stopSubsystem ()
 
 reset ()
 
 isTimeout ()
 
 disconnect ()
 
 __destruct ()
 
 isConnected ()
 
 isAuthenticated ()
 
 ping ()
 
 enableQuietMode ()
 
 disableQuietMode ()
 
 isQuietModeEnabled ()
 
 enablePTY ()
 
 disablePTY ()
 
 isPTYEnabled ()
 
 getLog ()
 
 getErrors ()
 
 getLastError ()
 
 getServerIdentification ()
 
 getServerAlgorithms ()
 
 getAlgorithmsNegotiated ()
 
 setTerminal ($term)
 
 setPreferredAlgorithms (array $methods)
 
 getBannerMessage ()
 
 getServerPublicHostKey ()
 
 getExitStatus ()
 
 getWindowColumns ()
 
 getWindowRows ()
 
 setWindowColumns ($value)
 
 setWindowRows ($value)
 
 setWindowSize ($columns=80, $rows=24)
 
 __toString ()
 
 getResourceId ()
 
 getAuthMethodsToContinue ()
 
 enableSmartMFA ()
 
 disableSmartMFA ()
 

Champs de données

const CHANNEL = 0x100
 
const SOURCE_LOCAL_FILE = 1
 
const SOURCE_STRING = 2
 
const SOURCE_CALLBACK = 16
 
const RESUME = 4
 
const RESUME_START = 8
 
- Champs de données hérités de SSH2
const NET_SSH2_COMPRESSION_NONE = 1
 
const NET_SSH2_COMPRESSION_ZLIB = 2
 
const NET_SSH2_COMPRESSION_ZLIB_AT_OPENSSH = 3
 
const MASK_CONSTRUCTOR = 0x00000001
 
const MASK_CONNECTED = 0x00000002
 
const MASK_LOGIN_REQ = 0x00000004
 
const MASK_LOGIN = 0x00000008
 
const MASK_SHELL = 0x00000010
 
const MASK_WINDOW_ADJUST = 0x00000020
 
const CHANNEL_EXEC = 1
 
const CHANNEL_SHELL = 2
 
const CHANNEL_SUBSYSTEM = 3
 
const CHANNEL_AGENT_FORWARD = 4
 
const CHANNEL_KEEP_ALIVE = 5
 
const LOG_SIMPLE = 1
 
const LOG_COMPLEX = 2
 
const LOG_REALTIME = 3
 
const LOG_REALTIME_FILE = 4
 
const LOG_MAX_SIZE = 1048576
 
const READ_SIMPLE = 1
 
const READ_REGEX = 2
 
const READ_NEXT = 3
 
 $fsock
 

Fonctions membres protégées

 parseAttributes (&$response)
 
 reset_connection ($reason)
 
 disconnect_helper ($reason)
 
- Fonctions membres protégées hérités de SSH2
 sublogin ($username,... $args)
 
 reset_connection ($reason)
 
 get_channel_packet ($client_channel, $skip_extended=false)
 
 send_binary_packet ($data, $logged=null)
 
 send_channel_packet ($client_channel, $data)
 
 disconnect_helper ($reason)
 
 define_array (... $args)
 
 format_log ($message_log, $message_number_log)
 

Attributs protégés

 $sortOptions = []
 
- Attributs protégés hérités de SSH2
 $bitmap = 0
 
 $server_identifier = false
 
 $server_channels = []
 
 $channel_status = []
 
 $window_size = 0x7FFFFFFF
 
 $window_size_server_to_client = []
 
 $timeout
 
 $curTimeout
 
 $preferred_signature_format = false
 
 $auth = []
 

Fonctions membres privées

 precheck ()
 
 partial_init_sftp_connection ()
 
 init_sftp_connection ()
 
 logError ($response, $status=-1)
 
 nlist_helper ($dir, $recursive, $relativeDir)
 
 readlist ($dir, $raw=true)
 
 comparator ($a, $b)
 
 update_stat_cache ($path, $value)
 
 remove_from_stat_cache ($path)
 
 query_stat_cache ($path)
 
 stat_helper ($filename, $type)
 
 setstat ($filename, $attr, $recursive)
 
 setstat_recursive ($path, $attr, &$i)
 
 mkdir_helper ($dir, $mode)
 
 read_put_responses ($i)
 
 close_handle ($handle)
 
 delete_recursive ($path, &$i)
 
 get_stat_cache_prop ($path, $prop)
 
 get_lstat_cache_prop ($path, $prop)
 
 get_xstat_cache_prop ($path, $prop, $type)
 
 parseTime ($key, $flags, &$response)
 
 parseMode ($mode)
 
 parseLongname ($longname)
 
 send_sftp_packet ($type, $data, $request_id=1)
 

Attributs privés

 $packet_types = []
 
 $status_codes = []
 
 $attributes
 
 $open_flags
 
 $open_flags5
 
 $file_types
 
 $use_request_id = false
 
 $packet_type = -1
 
 $packet_buffer = ''
 
 $extensions = []
 
 $version
 
 $defaultVersion
 
 $preferredVersion = 3
 
 $pwd = false
 
 $packet_type_log = []
 
 $packet_log = []
 
 $sftp_errors = []
 
 $stat_cache = []
 
 $max_sftp_packet
 
 $use_stat_cache = true
 
 $canonicalize_paths = true
 
 $requestBuffer = []
 
 $preserveTime = false
 
 $allow_arbitrary_length_packets = false
 
 $channel_close = false
 
 $partial_init = false
 

Membres hérités additionnels

- Fonctions membres publiques statiques hérités de SSH2
static setCryptoEngine ($engine)
 
static getSupportedKEXAlgorithms ()
 
static getSupportedHostKeyAlgorithms ()
 
static getSupportedEncryptionAlgorithms ()
 
static getSupportedMACAlgorithms ()
 
static getSupportedCompressionAlgorithms ()
 
static getConnectionByResourceId ($id)
 

Documentation des constructeurs et destructeur

◆ __construct()

__construct (   $host,
  $port = 22,
  $timeout = 10 
)

Default Constructor.

Connects to an SFTP server

Paramètres
string$host
int$port
int$timeoutpublic

Références SSH2\$host, SSH2\$port, SSH2\$timeout, Symfony\Contracts\Service\__construct(), et SSH2\define_array().

Documentation des fonctions membres

◆ chdir()

chdir (   $dir)

◆ chgrp()

chgrp (   $filename,
  $gid,
  $recursive = false 
)

Changes file or directory group

$gid should be an int for SFTPv3 and a string for SFTPv4+. Ideally the string would be of the form "user@dns_domain" but it does not need to be. ‘$sftp->getSupportedVersions()['version’]` will return the specific version that's being used.

Returns true on success or false on error.

Paramètres
string$filename
int | string$gid
bool$recursive
Renvoie
bool public

Références $attr, Strings\packSSH2(), et SFTP\setstat().

◆ chmod()

chmod (   $mode,
  $filename,
  $recursive = false 
)

Set permissions on a file.

Returns the new file permissions on success or false on error. If $recursive is true than this just returns true or false.

Paramètres
int$mode
string$filename
bool$recursive
Exceptions

Références $attr, $mode, $temp, SFTP\logError(), SFTP\parseAttributes(), SFTP\realpath(), SFTP\send_sftp_packet(), et SFTP\setstat().

Référencé par SFTP\mkdir_helper().

◆ chown()

chown (   $filename,
  $uid,
  $recursive = false 
)

Changes file or directory owner

$uid should be an int for SFTPv3 and a string for SFTPv4+. Ideally the string would be of the form "user@dns_domain" but it does not need to be. ‘$sftp->getSupportedVersions()['version’]` will return the specific version that's being used.

Returns true on success or false on error.

Paramètres
string$filename
int | string$uid
bool$recursive
Renvoie
bool public

Références $attr, Strings\packSSH2(), et SFTP\setstat().

◆ clearStatCache()

clearStatCache ( )

Clear the stat cache

public

◆ close_handle()

close_handle (   $handle)
private

Close handle

Paramètres
string$handle
Renvoie
bool
Exceptions

Références SFTP\logError(), SFTP\send_sftp_packet(), et Strings\unpackSSH2().

Référencé par SFTP\chdir(), SFTP\get(), SFTP\put(), SFTP\readlist(), et SFTP\touch().

◆ comparator()

comparator (   $a,
  $b 
)
private

Compares two rawlist entries using parameters set by setListOrder()

Intended for use with uasort()

Paramètres
array$a
array$b
Renvoie
int private

Références $b, $result, et $sort.

◆ delete()

delete (   $path,
  $recursive = true 
)

Deletes a file on the SFTP server.

Paramètres
string$path
bool$recursive
Renvoie
bool
Exceptions

Références $i, $path, $result, SFTP\delete_recursive(), SFTP\logError(), SFTP\precheck(), SFTP\read_put_responses(), SFTP\realpath(), SFTP\remove_from_stat_cache(), SFTP\send_sftp_packet(), et Strings\unpackSSH2().

◆ delete_recursive()

delete_recursive (   $path,
$i 
)
private

Recursively deletes directories on the SFTP server

Minimizes directory lookups and SSH_FXP_STATUS requests for speed.

Paramètres
string$path
int$i
Renvoie
bool private

Références $i, $path, $temp, Strings\packSSH2(), SFTP\read_put_responses(), SFTP\readlist(), SFTP\remove_from_stat_cache(), et SFTP\send_sftp_packet().

Référencé par SFTP\delete().

◆ disableArbitraryLengthPackets()

disableArbitraryLengthPackets ( )

Disable arbitrary length packets

public

◆ disableDatePreservation()

disableDatePreservation ( )

Disable Date Preservation

public

◆ disablePathCanonicalization()

disablePathCanonicalization ( )

Enable path canonicalization

public

◆ disableStatCache()

disableStatCache ( )

Disable the stat cache

public

◆ disconnect_helper()

disconnect_helper (   $reason)
protected

Disconnect

Paramètres
int$reason
Renvoie
false protected

◆ enableArbitraryLengthPackets()

enableArbitraryLengthPackets ( )

Enable arbitrary length packets

public

◆ enableDatePreservation()

enableDatePreservation ( )

Enable Date Preservation

public

◆ enablePathCanonicalization()

enablePathCanonicalization ( )

Enable path canonicalization

public

◆ enableStatCache()

enableStatCache ( )

Enable the stat cache

public

◆ file_exists()

file_exists (   $path)

Checks whether a file or directory exists

Paramètres
string$path
Renvoie
bool public

Références $path, $result, SFTP\precheck(), SFTP\query_stat_cache(), SFTP\realpath(), et SFTP\stat().

◆ fileatime()

fileatime (   $path)

Gets last access time of file

Paramètres
string$path
Renvoie
mixed public

Références $path, et SFTP\get_stat_cache_prop().

◆ filegroup()

filegroup (   $path)

Gets file group

Paramètres
string$path
Renvoie
mixed public

Références $path, et SFTP\get_stat_cache_prop().

◆ filemtime()

filemtime (   $path)

Gets file modification time

Paramètres
string$path
Renvoie
mixed public

Références $path, et SFTP\get_stat_cache_prop().

◆ fileowner()

fileowner (   $path)

Gets file owner

Paramètres
string$path
Renvoie
mixed public

Références $path, et SFTP\get_stat_cache_prop().

◆ fileperms()

fileperms (   $path)

Gets file permissions

Paramètres
string$path
Renvoie
mixed public

Références $path, et SFTP\get_stat_cache_prop().

◆ filesize()

filesize (   $path)

Gets file size

Paramètres
string$path
Renvoie
mixed public

Références $path, et SFTP\get_stat_cache_prop().

◆ filetype()

filetype (   $path)

Gets file type

Paramètres
string$path
Renvoie
string|false public

Références $path, $type, et SFTP\get_stat_cache_prop().

◆ get()

get (   $remote_file,
  $local_file = false,
  $offset = 0,
  $length = -1,
  $progressCallback = null 
)

Downloads a file from the SFTP server.

Returns a string containing the contents of $remote_file if $local_file is left undefined or a boolean false if the operation was unsuccessful. If $local_file is defined, returns true or false depending on the success of the operation.

$offset and $length can be used to download files in chunks.

Paramètres
string$remote_file
string | bool | resource | callable$local_file
int$offset
int$length
callable | null$progressCallback
Exceptions

Références $content, $i, SFTP\$max_sftp_packet, Joomla\Database\Query\$offset, $start, $temp, SFTP\close_handle(), elseif, SFTP\init_sftp_connection(), SFTP\logError(), null, Strings\packSSH2(), SFTP\precheck(), SFTP\realpath(), SFTP\send_sftp_packet(), SFTP\stat(), et SFTP\touch().

◆ get_lstat_cache_prop()

get_lstat_cache_prop (   $path,
  $prop 
)
private

Return an lstat properity

Uses cache if appropriate.

Paramètres
string$path
string$prop
Renvoie
mixed private

Références $path, et SFTP\get_xstat_cache_prop().

Référencé par SFTP\is_link().

◆ get_stat_cache_prop()

get_stat_cache_prop (   $path,
  $prop 
)
private

Return a stat properity

Uses cache if appropriate.

Paramètres
string$path
string$prop
Renvoie
mixed private

Références $path, et SFTP\get_xstat_cache_prop().

Référencé par SFTP\fileatime(), SFTP\filegroup(), SFTP\filemtime(), SFTP\fileowner(), SFTP\fileperms(), SFTP\filesize(), SFTP\filetype(), SFTP\is_dir(), et SFTP\is_file().

◆ get_xstat_cache_prop()

get_xstat_cache_prop (   $path,
  $prop,
  $type 
)
private

Return a stat or lstat properity

Uses cache if appropriate.

Paramètres
string$path
string$prop
string$type
Renvoie
mixed private

Références $path, $result, $type, SFTP\precheck(), SFTP\query_stat_cache(), et SFTP\realpath().

Référencé par SFTP\get_lstat_cache_prop(), et SFTP\get_stat_cache_prop().

◆ getLastSFTPError()

getLastSFTPError ( )

Returns the last error

Renvoie
string public

◆ getNegotiatedVersion()

getNegotiatedVersion ( )

Get supported SFTP versions

Renvoie
int|false public

Références $version.

◆ getSFTPErrors()

getSFTPErrors ( )

Returns all errors

Renvoie
array public

◆ getSFTPLog()

getSFTPLog ( )

Returns a log of the packets that have been sent and received.

Returns a string if NET_SFTP_LOGGING == self::LOG_COMPLEX, an array if NET_SFTP_LOGGING == self::LOG_SIMPLE and false if !defined('NET_SFTP_LOGGING')

public

Renvoie
array|string

◆ getSupportedVersions()

getSupportedVersions ( )

Get supported SFTP versions

Renvoie
array public

Références $temp, et SSH2\MASK_LOGIN.

◆ init_sftp_connection()

init_sftp_connection ( )
private

◆ is_dir()

is_dir (   $path)

Tells whether the filename is a directory

Paramètres
string$path
Renvoie
bool public

Références $path, $result, et SFTP\get_stat_cache_prop().

◆ is_file()

is_file (   $path)

Tells whether the filename is a regular file

Paramètres
string$path
Renvoie
bool public

Références $path, $result, et SFTP\get_stat_cache_prop().

Référencé par SFTP\put().

◆ is_link()

is_link (   $path)

Tells whether the filename is a symbolic link

Paramètres
string$path
Renvoie
bool public

Références $path, $result, et SFTP\get_lstat_cache_prop().

◆ is_readable()

is_readable (   $path)

Tells whether a file exists and is readable

Paramètres
string$path
Renvoie
bool public

Références $path, Strings\packSSH2(), SFTP\precheck(), SFTP\realpath(), et SFTP\send_sftp_packet().

◆ is_writable()

is_writable (   $path)

Tells whether the filename is writable

Paramètres
string$path
Renvoie
bool public

Références $path, Strings\packSSH2(), SFTP\precheck(), SFTP\realpath(), et SFTP\send_sftp_packet().

Référencé par SFTP\is_writeable().

◆ is_writeable()

is_writeable (   $path)

Tells whether the filename is writeable

Alias of is_writable

Paramètres
string$path
Renvoie
bool public

Références $path, et SFTP\is_writable().

◆ logError()

◆ lstat()

lstat (   $filename)

Returns general information about a file or symbolic link.

Returns an array on success and false otherwise.

Paramètres
string$filename
Renvoie
array|false public

Références SFTP\$pwd, $result, SFTP\chdir(), SFTP\precheck(), SFTP\pwd(), SFTP\query_stat_cache(), SFTP\realpath(), SFTP\remove_from_stat_cache(), SFTP\stat_helper(), et SFTP\update_stat_cache().

Référencé par SFTP\rawlist(), et SFTP\update_stat_cache().

◆ mkdir()

mkdir (   $dir,
  $mode = -1,
  $recursive = false 
)

Creates a directory.

Paramètres
string$dir
int$mode
bool$recursive
Renvoie
bool public

Références $dir, $i, $mode, $result, $temp, SFTP\mkdir_helper(), SFTP\precheck(), et SFTP\realpath().

◆ mkdir_helper()

mkdir_helper (   $dir,
  $mode 
)
private

Helper function for directory creation

Paramètres
string$dir
int$mode
Renvoie
bool private

Références $dir, $mode, SFTP\chmod(), SFTP\logError(), Strings\packSSH2(), SFTP\send_sftp_packet(), et Strings\unpackSSH2().

Référencé par SFTP\mkdir().

◆ nlist()

nlist (   $dir = '.',
  $recursive = false 
)

Returns a list of files in the given directory

Paramètres
string$dir
bool$recursive
Renvoie
array|false public

Références $dir, et SFTP\nlist_helper().

◆ nlist_helper()

nlist_helper (   $dir,
  $recursive,
  $relativeDir 
)
private

Helper method for nlist

Paramètres
string$dir
bool$recursive
string$relativeDir
Renvoie
array|false private

Références $dir, $result, $temp, $value, SFTP\query_stat_cache(), SFTP\readlist(), et SFTP\realpath().

Référencé par SFTP\nlist().

◆ parseAttributes()

parseAttributes ( $response)
protected

Parse Attributes

See '7. File Attributes' of draft-ietf-secsh-filexfer-13 for more info.

Paramètres
string$response
Renvoie
array private

Références $attr, $count, $i, $key, $result, $type, $value, et Strings\unpackSSH2().

Référencé par SFTP\chmod(), SFTP\readlist(), et SFTP\stat_helper().

◆ parseLongname()

parseLongname (   $longname)
private

Parse Longname

SFTPv3 doesn't provide any easy way of identifying a file type. You could try to open a file as a directory and see if an error is returned or you could try to parse the SFTPv3-specific longname field of the SSH_FXP_NAME packet. That's what this function does. The result is returned using the SFTPv4 type constants.

If the longname is in an unrecognized format bool(false) is returned.

Paramètres
string$longname
Renvoie
mixed private

Référencé par SFTP\readlist().

◆ parseMode()

parseMode (   $mode)
private

Attempt to identify the file type

Quoting the SFTP RFC, "Implementations MUST NOT send bits that are not defined" but they seem to anyway

Paramètres
int$mode
Renvoie
int private

Références $mode.

◆ parseTime()

parseTime (   $key,
  $flags,
$response 
)
private

Parse Time

See '7.7. Times' of draft-ietf-secsh-filexfer-13 for more info.

Paramètres
string$key
int$flags
string$response
Renvoie
array private

Références $attr, $key, et Strings\unpackSSH2().

◆ partial_init_sftp_connection()

partial_init_sftp_connection ( )
private

◆ precheck()

◆ put()

put (   $remote_file,
  $data,
  $mode = self::SOURCE_STRING,
  $start = -1,
  $local_start = -1,
  $progressCallback = null 
)

Uploads a file to the SFTP server.

By default, ::put() does not read from the local filesystem. $data is dumped directly into $remote_file. So, for example, if you set $data to 'filename.ext' and then do get(), you will get a file, twelve bytes long, containing 'filename.ext' as its contents.

Setting $mode to self::SOURCE_LOCAL_FILE will change the above behavior. With self::SOURCE_LOCAL_FILE, $remote_file will contain as many bytes as filename.ext does on your local filesystem. If your filename.ext is 1MB then that is how large $remote_file will be, as well.

Setting $mode to self::SOURCE_CALLBACK will use $data as callback function, which gets only one parameter – number of bytes to return, and returns a string if there is some data or null if there is no more data

If $data is a resource then it'll be used as a resource instead.

Currently, only binary mode is supported. As such, if the line endings need to be adjusted, you will need to take care of that, yourself.

$mode can take an additional two parameters - self::RESUME and self::RESUME_START. These are bitwise AND'd with $mode. So if you want to resume upload of a 300mb file on the local file system you'd set $mode to the following:

self::SOURCE_LOCAL_FILE | self::RESUME

If you wanted to simply append the full contents of a local file to the full contents of a remote file you'd replace self::RESUME with self::RESUME_START.

If $mode & (self::RESUME | self::RESUME_START) then self::RESUME_START will be assumed.

$start and $local_start give you more fine grained control over this process and take precident over self::RESUME when they're non-negative. ie. $start could let you write at the end of a file (like self::RESUME) or in the middle of one. $local_start could let you start your reading from the end of a file (like self::RESUME_START) or in the middle of one.

Setting $local_start to > 0 or $mode | self::RESUME_START doesn't do anything unless $mode | self::SOURCE_LOCAL_FILE.

{

Références $attr, $data, $i, $info, SFTP\$max_sftp_packet, $mode, Joomla\Database\Query\$offset, $result, $size, $start, $temp, SFTP\close_handle(), elseif, SFTP\is_file(), SFTP\logError(), Strings\packSSH2(), SFTP\precheck(), SFTP\read_put_responses(), SFTP\realpath(), SFTP\remove_from_stat_cache(), SFTP\send_sftp_packet(), SFTP\setstat(), SFTP\SOURCE_LOCAL_FILE, et SFTP\stat().

◆ pwd()

pwd ( )

Returns the current directory name

Renvoie
string|bool public

Références SFTP\$pwd, et SFTP\precheck().

Référencé par SFTP\chdir(), SFTP\init_sftp_connection(), SFTP\lstat(), SFTP\precheck(), SFTP\realpath(), et SFTP\stat().

◆ query_stat_cache()

query_stat_cache (   $path)
private

Checks cache for path

Mainly used by file_exists

Paramètres
string$path
Renvoie
mixed private

Références $dir, $path, SFTP\$stat_cache, $temp, et null.

Référencé par SFTP\chdir(), SFTP\file_exists(), SFTP\get_xstat_cache_prop(), SFTP\lstat(), SFTP\nlist_helper(), SFTP\rawlist(), et SFTP\stat().

◆ rawlist()

rawlist (   $dir = '.',
  $recursive = false 
)

Returns a detailed list of files in the given directory

Paramètres
string$dir
bool$recursive
Renvoie
array|false public

Références $dir, $key, $value, SFTP\lstat(), SFTP\query_stat_cache(), SFTP\readlist(), et SFTP\realpath().

◆ read_put_responses()

read_put_responses (   $i)
private

Reads multiple successive SSH_FXP_WRITE responses

Sending an SSH_FXP_WRITE packet and immediately reading its response isn't as efficient as blindly sending out $i SSH_FXP_WRITEs, in succession, and then reading $i responses.

Paramètres
int$i
Renvoie
bool
Exceptions

Références $i, SFTP\logError(), et Strings\unpackSSH2().

Référencé par SFTP\delete(), SFTP\delete_recursive(), SFTP\put(), SFTP\setstat(), et SFTP\setstat_recursive().

◆ readlink()

readlink (   $link)

Return the target of a symbolic link

Paramètres
string$link
Exceptions

Références $count, $link, SFTP\logError(), Strings\packSSH2(), SFTP\precheck(), SFTP\realpath(), SFTP\send_sftp_packet(), et Strings\unpackSSH2().

◆ readlist()

readlist (   $dir,
  $raw = true 
)
private

Reads a list, be it detailed or not, of files in the given directory

Paramètres
string$dir
bool$raw
Renvoie
array|false
Exceptions

Références SFTP\$attributes, $count, $dir, $i, $temp, $this, SFTP\close_handle(), SFTP\logError(), Strings\packSSH2(), SFTP\parseAttributes(), SFTP\parseLongname(), SFTP\precheck(), SFTP\realpath(), SFTP\send_sftp_packet(), Strings\unpackSSH2(), et SFTP\update_stat_cache().

Référencé par SFTP\delete_recursive(), SFTP\nlist_helper(), SFTP\rawlist(), et SFTP\setstat_recursive().

◆ realpath()

realpath (   $path)

Canonicalize the Server-Side Path Name

SFTP doesn't provide a mechanism by which the current working directory can be changed, so we'll emulate it. Returns the absolute (canonicalized) path.

If canonicalize_paths has been disabled using disablePathCanonicalization(), $path is returned as-is.

Voir également
self::chdir()
self::disablePathCanonicalization()
Paramètres
string$path
Exceptions

Références $dir, $path, SFTP\logError(), Strings\packSSH2(), SFTP\precheck(), SFTP\pwd(), SFTP\send_sftp_packet(), et Strings\unpackSSH2().

Référencé par SFTP\chdir(), SFTP\chmod(), SFTP\delete(), SFTP\file_exists(), SFTP\get(), SFTP\get_xstat_cache_prop(), SFTP\init_sftp_connection(), SFTP\is_readable(), SFTP\is_writable(), SFTP\lstat(), SFTP\mkdir(), SFTP\nlist_helper(), SFTP\put(), SFTP\rawlist(), SFTP\readlink(), SFTP\readlist(), SFTP\rmdir(), SFTP\setstat(), SFTP\stat(), SFTP\symlink(), et SFTP\touch().

◆ remove_from_stat_cache()

remove_from_stat_cache (   $path)
private

Remove files / directories from cache

Paramètres
string$path
Renvoie
bool private

Références $dir, $i, $path, SFTP\$stat_cache, et $temp.

Référencé par SFTP\delete(), SFTP\delete_recursive(), SFTP\lstat(), SFTP\put(), SFTP\rmdir(), SFTP\setstat(), et SFTP\stat().

◆ rename()

rename (   $oldname,
  $newname 
)

Renames a file or a directory on the SFTP server.

If the file already exists this will return false

Paramètres
string$oldname
string$newname
Renvoie
bool
Exceptions

Références Strings\packSSH2(), et Strings\unpackSSH2().

◆ reset_connection()

reset_connection (   $reason)
protected

Resets a connection for re-use

Paramètres
int$reasonprivate

◆ rmdir()

rmdir (   $dir)

◆ send_sftp_packet()

send_sftp_packet (   $type,
  $data,
  $request_id = 1 
)
private

Sends SFTP Packets

See '6. General Packet Format' of draft-ietf-secsh-filexfer-13 for more info.

Paramètres
int$type
string$data
int$request_id
Voir également
self::_get_sftp_packet()
self::send_channel_packet()
Renvoie
void private

Références $data, $start, et $type.

Référencé par SFTP\chdir(), SFTP\chmod(), SFTP\close_handle(), SFTP\delete(), SFTP\delete_recursive(), SFTP\get(), SFTP\init_sftp_connection(), SFTP\is_readable(), SFTP\is_writable(), SFTP\mkdir_helper(), SFTP\partial_init_sftp_connection(), SFTP\put(), SFTP\readlink(), SFTP\readlist(), SFTP\realpath(), SFTP\rmdir(), SFTP\setstat(), SFTP\setstat_recursive(), SFTP\stat_helper(), SFTP\symlink(), et SFTP\touch().

◆ setListOrder()

setListOrder (   $args)

Defines how nlist() and rawlist() will be sorted - if at all.

If sorting is enabled directories and files will be sorted independently with directories appearing before files in the resultant array that is returned.

Any parameter returned by stat is a valid sort parameter for this function. Filename comparisons are case insensitive.

Examples:

$sftp->setListOrder('filename', SORT_ASC); $sftp->setListOrder('size', SORT_DESC, 'filename', SORT_ASC); $sftp->setListOrder(true); Separates directories from files but doesn't do any sorting beyond that $sftp->setListOrder(); Don't do any sort of sorting

Paramètres
string...$args public

Références $i.

◆ setPreferredVersion()

setPreferredVersion (   $version)

Set preferred version

If you're preferred version isn't supported then the highest supported version of SFTP will be utilized. Set to null or false or int(0) to unset the preferred version

Paramètres
int$versionpublic

Références $version.

◆ setstat()

setstat (   $filename,
  $attr,
  $recursive 
)
private

◆ setstat_recursive()

setstat_recursive (   $path,
  $attr,
$i 
)
private

Recursively sets information on directories on the SFTP server

Minimizes directory lookups and SSH_FXP_STATUS requests for speed.

Paramètres
string$path
string$attr
int$i
Renvoie
bool private

Références $attr, $i, $path, $temp, Strings\packSSH2(), SFTP\read_put_responses(), SFTP\readlist(), SFTP\send_sftp_packet(), et SFTP\setstat().

Référencé par SFTP\setstat().

◆ stat()

stat (   $filename)

Returns general information about a file.

Returns an array on success and false otherwise.

Paramètres
string$filename
Renvoie
array|false public

Références SFTP\$pwd, $result, SFTP\chdir(), SFTP\precheck(), SFTP\pwd(), SFTP\query_stat_cache(), SFTP\realpath(), SFTP\remove_from_stat_cache(), SFTP\stat_helper(), et SFTP\update_stat_cache().

Référencé par SFTP\file_exists(), SFTP\get(), SFTP\put(), et SFTP\update_stat_cache().

◆ stat_helper()

stat_helper (   $filename,
  $type 
)
private

Returns general information about a file or symbolic link

Determines information without calling ::realpath(). The second parameter can be either NET_SFTP_STAT or NET_SFTP_LSTAT.

Paramètres
string$filename
int$type
Exceptions

Références $type, SFTP\logError(), Strings\packSSH2(), SFTP\parseAttributes(), et SFTP\send_sftp_packet().

Référencé par SFTP\lstat(), et SFTP\stat().

◆ symlink()

symlink (   $target,
  $link 
)

Create a symlink

symlink() creates a symbolic link to the existing target with the specified name link.

Paramètres
string$target
string$link
Exceptions

Références $link, $target, $type, SFTP\logError(), Strings\packSSH2(), SFTP\precheck(), SFTP\realpath(), SFTP\send_sftp_packet(), et Strings\unpackSSH2().

◆ touch()

touch (   $filename,
  $time = null,
  $atime = null 
)

Sets access and modification time of file.

If the file does not exist, it will be created.

Paramètres
string$filename
int$time
int$atime
Exceptions

Références $attr, SFTP\close_handle(), SFTP\logError(), Strings\packSSH2(), SFTP\precheck(), SFTP\realpath(), SFTP\send_sftp_packet(), et SFTP\setstat().

Référencé par SFTP\get().

◆ truncate()

truncate (   $filename,
  $new_size 
)

Truncates a file to a given length

Paramètres
string$filename
int$new_size
Renvoie
bool public

Références $attr, Strings\packSSH2(), et SFTP\setstat().

◆ update_stat_cache()

update_stat_cache (   $path,
  $value 
)
private

Save files / directories to cache

Paramètres
string$path
mixed$valueprivate

Références $dir, $i, $path, SFTP\$stat_cache, $temp, $value, SFTP\lstat(), et SFTP\stat().

Référencé par SFTP\chdir(), SFTP\init_sftp_connection(), SFTP\lstat(), SFTP\readlist(), et SFTP\stat().

Documentation des champs

◆ $allow_arbitrary_length_packets

$allow_arbitrary_length_packets = false
private

◆ $attributes

$attributes
private

Référencé par SFTP\readlist().

◆ $canonicalize_paths

$canonicalize_paths = true
private

◆ $channel_close

$channel_close = false
private

◆ $defaultVersion

$defaultVersion
private

Référencé par SFTP\init_sftp_connection().

◆ $extensions

$extensions = []
private

◆ $file_types

$file_types
private

◆ $max_sftp_packet

$max_sftp_packet
private

Référencé par SFTP\get(), et SFTP\put().

◆ $open_flags

$open_flags
private

◆ $open_flags5

$open_flags5
private

◆ $packet_buffer

$packet_buffer = ''
private

◆ $packet_log

$packet_log = []
private

◆ $packet_type

$packet_type = -1
private

◆ $packet_type_log

$packet_type_log = []
private

◆ $packet_types

$packet_types = []
private

◆ $partial_init

$partial_init = false
private

◆ $preferredVersion

$preferredVersion = 3
private

◆ $preserveTime

$preserveTime = false
private

◆ $pwd

$pwd = false
private

Référencé par SFTP\lstat(), SFTP\pwd(), et SFTP\stat().

◆ $requestBuffer

$requestBuffer = []
private

◆ $sftp_errors

$sftp_errors = []
private

◆ $sortOptions

$sortOptions = []
protected

◆ $stat_cache

$stat_cache = []
private

◆ $status_codes

$status_codes = []
private

◆ $use_request_id

$use_request_id = false
private

◆ $use_stat_cache

$use_stat_cache = true
private

◆ $version

$version
private

◆ CHANNEL

const CHANNEL = 0x100

SFTP channel constant

::exec() uses 0 and ::read() / ::write() use 1.

Voir également
::send_channel_packet()
::get_channel_packet() private

◆ RESUME

const RESUME = 4

Resumes an upload

public

Voir également
::put()

◆ RESUME_START

const RESUME_START = 8

Append a local file to an already existing remote file

public

Voir également
::put()

◆ SOURCE_CALLBACK

const SOURCE_CALLBACK = 16

Reads data from callback: function callback($length) returns string to proceed, null for EOF

public

Voir également
::put()

◆ SOURCE_LOCAL_FILE

const SOURCE_LOCAL_FILE = 1

Reads data from a local file.

public

Voir également
::put()

Référencé par SFTP\put().

◆ SOURCE_STRING

const SOURCE_STRING = 2

Reads data from a string.

public

Voir également
::put()

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


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