Ftpd
extends Ftp
in package
Table of Contents
- $configurable : array<string|int, mixed>
- $connection : mixed
- $enableTimestampsOnUnixListings : bool
- True to enable timestamps for FTP servers that return unix-style listings.
- $host : string
- $ignorePassiveAddress : null|bool
- $isPureFtpd : bool
- $passive : bool
- $pathPrefix : string|null
- $pathSeparator : string
- $permPrivate : int
- $permPublic : int
- $port : int
- $recurseManually : bool
- $root : string|null
- $safeStorage : SafeStorage
- $separator : string
- $ssl : bool
- $systemType : string
- $timeout : int
- $transferMode : int
- $utf8 : bool
- __construct() : mixed
- Constructor.
- __destruct() : mixed
- Disconnect on destruction.
- applyPathPrefix() : string
- Prefix a path.
- connect() : mixed
- Establish a connection.
- copy() : bool
- Copy a file.
- createDir() : mixed
- delete() : mixed
- deleteDir() : mixed
- disconnect() : mixed
- Close the connection.
- ensureDirectory() : mixed
- Ensure a directory exists.
- getConnection() : mixed
- getHost() : string
- Returns the host.
- getMetadata() : mixed
- getMimetype() : mixed
- getPassword() : string
- Returns the password.
- getPathPrefix() : string|null
- Get the path prefix.
- getPermPrivate() : int
- Get the private permission value.
- getPermPublic() : int
- Get the public permission value.
- getPort() : int
- Returns the ftp port.
- getRoot() : string
- Returns the root folder to work from.
- getSize() : mixed
- getSystemType() : string
- Return the FTP system type.
- getTimeout() : int
- Returns the amount of seconds before the connection will timeout.
- getTimestamp() : mixed
- getUsername() : string
- Returns the ftp username.
- getVisibility() : mixed
- has() : mixed
- isConnected() : bool
- Check if a connection is active.
- listContents() : mixed
- read() : mixed
- readStream() : resource
- removeDotDirectories() : array<string|int, mixed>
- Filter out dot-directories.
- removePathPrefix() : string
- Remove a path prefix.
- rename() : mixed
- setConfig() : $this
- Set the config.
- setEnableTimestampsOnUnixListings() : $this
- True to enable timestamps for FTP servers that return unix-style listings.
- setHost() : $this
- Set the host.
- setIgnorePassiveAddress() : mixed
- setPassive() : mixed
- Set if passive mode should be used.
- setPassword() : $this
- Set the ftp password.
- setPathPrefix() : void
- Set the path prefix.
- setPermPrivate() : $this
- Set the private permission value.
- setPermPublic() : $this
- Set the public permission value.
- setPort() : $this
- Set the ftp port.
- setRecurseManually() : mixed
- setRoot() : $this
- Set the root folder to work from.
- setSsl() : $this
- Set if Ssl is enabled.
- setSystemType() : $this
- Set the FTP system type (windows or unix).
- setTimeout() : $this
- Set the amount of seconds before the connection should timeout.
- setTransferMode() : $this
- Set the transfer mode.
- setUsername() : $this
- Set ftp username.
- setUtf8() : mixed
- setVisibility() : mixed
- update() : mixed
- updateStream() : mixed
- write() : mixed
- writeStream() : resource
- createActualDirectory() : bool
- Create a directory.
- detectSystemType() : string
- Get the system type from a listing item.
- detectType() : string
- Get the file type from the permissions.
- escapePath() : mixed
- ftpRawlist() : array<string|int, mixed>
- The ftp_rawlist function with optional escaping.
- isPureFtpdServer() : bool
- listDirectoryContents() : mixed
- listDirectoryContentsRecursive() : mixed
- login() : mixed
- Login.
- normalizeListing() : array<string|int, mixed>
- Normalize a directory listing.
- normalizeObject() : array<string|int, mixed>
- Normalize a file entry.
- normalizePermissions() : int
- Normalize a permissions string.
- normalizeUnixObject() : array<string|int, mixed>
- Normalize a Unix file entry.
- normalizeUnixTimestamp() : int
- Only accurate to the minute (current year), or to the day.
- normalizeWindowsObject() : array<string|int, mixed>
- Normalize a Windows/DOS file entry.
- setConnectionPassiveMode() : mixed
- Set the connections to passive mode.
- setConnectionRoot() : mixed
- Set the connection root.
- setUtf8Mode() : mixed
- Set the connection to UTF-8 mode.
- sortListing() : array<string|int, mixed>
- Sort a directory listing.
- getRawExecResponseCode() : mixed
- hasFtpConnection() : bool
Properties
$configurable
protected
array<string|int, mixed>
$configurable
= []
$connection
protected
mixed
$connection
$enableTimestampsOnUnixListings
True to enable timestamps for FTP servers that return unix-style listings.
protected
bool
$enableTimestampsOnUnixListings
= false
$host
protected
string
$host
$ignorePassiveAddress
protected
null|bool
$ignorePassiveAddress
= null
$isPureFtpd
protected
bool
$isPureFtpd
$passive
protected
bool
$passive
= true
$pathPrefix
protected
string|null
$pathPrefix
path prefix
$pathSeparator
protected
string
$pathSeparator
= '/'
$permPrivate
protected
int
$permPrivate
= 0700
$permPublic
protected
int
$permPublic
= 0744
$port
protected
int
$port
= 21
$recurseManually
protected
bool
$recurseManually
= false
$root
protected
string|null
$root
$safeStorage
protected
SafeStorage
$safeStorage
$separator
protected
string
$separator
= '/'
$ssl
protected
bool
$ssl
= false
$systemType
protected
string
$systemType
$timeout
protected
int
$timeout
= 90
$transferMode
protected
int
$transferMode
= FTP_BINARY
$utf8
protected
bool
$utf8
= false
Methods
__construct()
Constructor.
public
__construct(array<string|int, mixed> $config) : mixed
Parameters
- $config : array<string|int, mixed>
Return values
mixed —__destruct()
Disconnect on destruction.
public
__destruct() : mixed
Return values
mixed —applyPathPrefix()
Prefix a path.
public
applyPathPrefix(string $path) : string
Parameters
- $path : string
Return values
string —prefixed path
connect()
Establish a connection.
public
abstract connect() : mixed
Return values
mixed —copy()
Copy a file.
public
copy(string $path, string $newpath) : bool
Parameters
- $path : string
- $newpath : string
Return values
bool —createDir()
public
createDir(mixed $dirname, Config $config) : mixed
Parameters
- $dirname : mixed
- $config : Config
Tags
Return values
mixed —delete()
public
delete(mixed $path) : mixed
Parameters
- $path : mixed
Tags
Return values
mixed —deleteDir()
public
deleteDir(mixed $dirname) : mixed
Parameters
- $dirname : mixed
Tags
Return values
mixed —disconnect()
Close the connection.
public
abstract disconnect() : mixed
Return values
mixed —ensureDirectory()
Ensure a directory exists.
public
ensureDirectory(string $dirname) : mixed
Parameters
- $dirname : string
Return values
mixed —getConnection()
public
getConnection() : mixed
Return values
mixed —getHost()
Returns the host.
public
getHost() : string
Return values
string —getMetadata()
public
getMetadata(mixed $path) : mixed
Parameters
- $path : mixed
Tags
Return values
mixed —getMimetype()
public
getMimetype(mixed $path) : mixed
Parameters
- $path : mixed
Tags
Return values
mixed —getPassword()
Returns the password.
public
getPassword() : string
Return values
string —password
getPathPrefix()
Get the path prefix.
public
getPathPrefix() : string|null
Return values
string|null —path prefix or null if pathPrefix is empty
getPermPrivate()
Get the private permission value.
public
getPermPrivate() : int
Return values
int —getPermPublic()
Get the public permission value.
public
getPermPublic() : int
Return values
int —getPort()
Returns the ftp port.
public
getPort() : int
Return values
int —getRoot()
Returns the root folder to work from.
public
getRoot() : string
Return values
string —getSize()
public
getSize(mixed $path) : mixed
Parameters
- $path : mixed
Tags
Return values
mixed —getSystemType()
Return the FTP system type.
public
getSystemType() : string
Return values
string —getTimeout()
Returns the amount of seconds before the connection will timeout.
public
getTimeout() : int
Return values
int —getTimestamp()
public
getTimestamp(mixed $path) : mixed
Parameters
- $path : mixed
Tags
Return values
mixed —getUsername()
Returns the ftp username.
public
getUsername() : string
Return values
string —username
getVisibility()
public
getVisibility(mixed $path) : mixed
Parameters
- $path : mixed
Tags
Return values
mixed —has()
public
has(mixed $path) : mixed
Parameters
- $path : mixed
Tags
Return values
mixed —isConnected()
Check if a connection is active.
public
abstract isConnected() : bool
Return values
bool —listContents()
public
listContents([mixed $directory = '' ][, mixed $recursive = false ]) : mixed
Parameters
- $directory : mixed = ''
- $recursive : mixed = false
Tags
Return values
mixed —read()
public
read(mixed $path) : mixed
Parameters
- $path : mixed
Tags
Return values
mixed —readStream()
public
abstract readStream(string $path) : resource
Parameters
- $path : string
Return values
resource —removeDotDirectories()
Filter out dot-directories.
public
removeDotDirectories(array<string|int, mixed> $list) : array<string|int, mixed>
Parameters
- $list : array<string|int, mixed>
Return values
array<string|int, mixed> —removePathPrefix()
Remove a path prefix.
public
removePathPrefix(string $path) : string
Parameters
- $path : string
Return values
string —path without the prefix
rename()
public
rename(mixed $path, mixed $newpath) : mixed
Parameters
- $path : mixed
- $newpath : mixed
Tags
Return values
mixed —setConfig()
Set the config.
public
setConfig(array<string|int, mixed> $config) : $this
Parameters
- $config : array<string|int, mixed>
Return values
$this —setEnableTimestampsOnUnixListings()
True to enable timestamps for FTP servers that return unix-style listings.
public
setEnableTimestampsOnUnixListings([bool $bool = false ]) : $this
Parameters
- $bool : bool = false
Return values
$this —setHost()
Set the host.
public
setHost(string $host) : $this
Parameters
- $host : string
Return values
$this —setIgnorePassiveAddress()
public
setIgnorePassiveAddress(bool $ignorePassiveAddress) : mixed
Parameters
- $ignorePassiveAddress : bool
Return values
mixed —setPassive()
Set if passive mode should be used.
public
setPassive([bool $passive = true ]) : mixed
Parameters
- $passive : bool = true
Return values
mixed —setPassword()
Set the ftp password.
public
setPassword(string $password) : $this
Parameters
- $password : string
Return values
$this —setPathPrefix()
Set the path prefix.
public
setPathPrefix(string $prefix) : void
Parameters
- $prefix : string
Return values
void —setPermPrivate()
Set the private permission value.
public
setPermPrivate(int $permPrivate) : $this
Parameters
- $permPrivate : int
Return values
$this —setPermPublic()
Set the public permission value.
public
setPermPublic(int $permPublic) : $this
Parameters
- $permPublic : int
Return values
$this —setPort()
Set the ftp port.
public
setPort(int|string $port) : $this
Parameters
- $port : int|string
Return values
$this —setRecurseManually()
public
setRecurseManually(bool $recurseManually) : mixed
Parameters
- $recurseManually : bool
Return values
mixed —setRoot()
Set the root folder to work from.
public
setRoot(string $root) : $this
Parameters
- $root : string
Return values
$this —setSsl()
Set if Ssl is enabled.
public
setSsl(bool $ssl) : $this
Parameters
- $ssl : bool
Return values
$this —setSystemType()
Set the FTP system type (windows or unix).
public
setSystemType(string $systemType) : $this
Parameters
- $systemType : string
Return values
$this —setTimeout()
Set the amount of seconds before the connection should timeout.
public
setTimeout(int $timeout) : $this
Parameters
- $timeout : int
Return values
$this —setTransferMode()
Set the transfer mode.
public
setTransferMode(int $mode) : $this
Parameters
- $mode : int
Return values
$this —setUsername()
Set ftp username.
public
setUsername(string $username) : $this
Parameters
- $username : string
Return values
$this —setUtf8()
public
setUtf8(bool $utf8) : mixed
Parameters
- $utf8 : bool
Return values
mixed —setVisibility()
public
setVisibility(mixed $path, mixed $visibility) : mixed
Parameters
- $path : mixed
- $visibility : mixed
Tags
Return values
mixed —update()
public
update(mixed $path, mixed $contents, Config $config) : mixed
Parameters
- $path : mixed
- $contents : mixed
- $config : Config
Tags
Return values
mixed —updateStream()
public
updateStream(mixed $path, mixed $resource, Config $config) : mixed
Parameters
- $path : mixed
- $resource : mixed
- $config : Config
Tags
Return values
mixed —write()
public
write(mixed $path, mixed $contents, Config $config) : mixed
Parameters
- $path : mixed
- $contents : mixed
- $config : Config
Tags
Return values
mixed —writeStream()
public
abstract writeStream(string $path, resource $resource, Config $config) : resource
Parameters
- $path : string
- $resource : resource
- $config : Config
Return values
resource —createActualDirectory()
Create a directory.
protected
createActualDirectory(string $directory, resource $connection) : bool
Parameters
- $directory : string
- $connection : resource
Return values
bool —detectSystemType()
Get the system type from a listing item.
protected
detectSystemType(string $item) : string
Parameters
- $item : string
Return values
string —the system type
detectType()
Get the file type from the permissions.
protected
detectType(string $permissions) : string
Parameters
- $permissions : string
Return values
string —file type
escapePath()
protected
escapePath(mixed $path) : mixed
Parameters
- $path : mixed
Return values
mixed —ftpRawlist()
The ftp_rawlist function with optional escaping.
protected
ftpRawlist(string $options, string $path) : array<string|int, mixed>
Parameters
- $options : string
- $path : string
Return values
array<string|int, mixed> —isPureFtpdServer()
protected
isPureFtpdServer() : bool
Return values
bool —listDirectoryContents()
protected
listDirectoryContents(mixed $directory[, mixed $recursive = true ]) : mixed
Parameters
- $directory : mixed
- $recursive : mixed = true
Tags
Return values
mixed —listDirectoryContentsRecursive()
protected
listDirectoryContentsRecursive(string $directory) : mixed
Parameters
- $directory : string
Tags
Return values
mixed —login()
Login.
protected
login() : mixed
Tags
Return values
mixed —normalizeListing()
Normalize a directory listing.
protected
normalizeListing(array<string|int, mixed> $listing[, string $prefix = '' ]) : array<string|int, mixed>
Parameters
- $listing : array<string|int, mixed>
- $prefix : string = ''
Return values
array<string|int, mixed> —directory listing
normalizeObject()
Normalize a file entry.
protected
normalizeObject(string $item, string $base) : array<string|int, mixed>
Parameters
- $item : string
- $base : string
Tags
Return values
array<string|int, mixed> —normalized file array
normalizePermissions()
Normalize a permissions string.
protected
normalizePermissions(string $permissions) : int
Parameters
- $permissions : string
Return values
int —normalizeUnixObject()
Normalize a Unix file entry.
protected
normalizeUnixObject(string $item, string $base) : array<string|int, mixed>
Given $item contains: '-rw-r--r-- 1 ftp ftp 409 Aug 19 09:01 file1.txt'
This function will return: [ 'type' => 'file', 'path' => 'file1.txt', 'visibility' => 'public', 'size' => 409, 'timestamp' => 1566205260 ]
Parameters
- $item : string
- $base : string
Return values
array<string|int, mixed> —normalized file array
normalizeUnixTimestamp()
Only accurate to the minute (current year), or to the day.
protected
normalizeUnixTimestamp(string $month, string $day, string $timeOrYear) : int
Inadequacies in timestamp accuracy are due to limitations of the FTP 'LIST' command
Note: The 'MLSD' command is a machine-readable replacement for 'LIST' but many FTP servers do not support it :(
Parameters
- $month : string
-
e.g. 'Aug'
- $day : string
-
e.g. '19'
- $timeOrYear : string
-
e.g. '09:01' OR '2015'
Return values
int —normalizeWindowsObject()
Normalize a Windows/DOS file entry.
protected
normalizeWindowsObject(string $item, string $base) : array<string|int, mixed>
Parameters
- $item : string
- $base : string
Return values
array<string|int, mixed> —normalized file array
setConnectionPassiveMode()
Set the connections to passive mode.
protected
setConnectionPassiveMode() : mixed
Tags
Return values
mixed —setConnectionRoot()
Set the connection root.
protected
setConnectionRoot() : mixed
Return values
mixed —setUtf8Mode()
Set the connection to UTF-8 mode.
protected
setUtf8Mode() : mixed
Return values
mixed —sortListing()
Sort a directory listing.
protected
sortListing(array<string|int, mixed> $result) : array<string|int, mixed>
Parameters
- $result : array<string|int, mixed>
Return values
array<string|int, mixed> —sorted listing
getRawExecResponseCode()
private
getRawExecResponseCode(mixed $command) : mixed
Parameters
- $command : mixed
Return values
mixed —hasFtpConnection()
private
hasFtpConnection() : bool