public | #__construct(array$params= []) Instantiates the library Parameters- $params
array $params Optional parameters - see class P_* constants
ThrowsSee |
public staticAlo\SFTP | #sftp(array$params= []) Instantiates the library Parameters- $params
array $params Optional parameters - see class P_* constants
ReturnsThrowsSee |
public boolean|integer | #retryCount(integer$int= -1) If no parameter is passed gets the maximum amount of retry attempts for failed operations, otherwise sets it. If no parameter is passed gets the maximum amount of retry attempts for failed operations, otherwise sets it. Parameters- $int
integer $int The amount
Returnsboolean|integer
Author |
public boolean | #retryTime(integer$int= -1) If no parameter is passed gets the time to wait between operation retries, otherwise sets it If no parameter is passed gets the time to wait between operation retries, otherwise sets it Parameters- $int
integer $int The time in seconds
Returnsboolean
Author |
publicAlo\SFTP | #loc(string$dir) Sets the local directory Parameters- $dir
string $dir The directory path
ReturnsAuthor |
public array | #scandir(integer$sortingOrder=Alo\SFTP::SORT_ASC ) Scans a directory for files and subdirectories Scans a directory for files and subdirectories Parameters- $sortingOrder
integer $sortingOrder The sorting order
Returnsarray ["dirs" => [], "files" => []]
Author |
publicAlo\SFTP | #checkSubsystem( ) Checks if the SFTP subsystem was initialised Checks if the SFTP subsystem was initialised ReturnsThrowsAuthor |
publicAlo\SFTP | #connect(integer$attempt=0) Creates a SSH2 connection Creates a SSH2 connection Parameters- $attempt
integer $attempt Current attempt number
ReturnsThrowsAuthor |
protectedAlo\SFTP | #auth(integer$attempt=0) Authenticates the SSH2 connection Authenticates the SSH2 connection Parameters- $attempt
integer $attempt The current attempt # at authentication
ReturnsThrowsAuthor |
protectedAlo\SFTP | #ssh2Sftp(integer$attempt=0) Initialises the SFTP subsystem Initialises the SFTP subsystem Parameters- $attempt
integer $attempt Current retry number
ReturnsThrowsAuthor |
protected static boolean | #isFile(string$resource) Checks whether a resource is a file or directory based on whether it has a file extension Checks whether a resource is a file or directory based on whether it has a file extension Parameters- $resource
string $resource The resource name to check
Returnsboolean
Author |
publicAlo\SFTP | #downloadFile(string$file) Downloads a file to $this->localDir Downloads a file to $this->localDir Parameters- $file
string $file Remote file name
ReturnsThrowsAuthorSee |
public string | #getFileContents(string$file) Gets the file contents Parameters- $file
string $file File name
Returnsstring String representation of the file
ThrowsAuthor |
protected string | #resolvePath(string$item) Modifies the path based on whether it's relative or absolute Modifies the path based on whether it's relative or absolute Parameters- $item
string $item Item name
Returnsstring The resolved path
Author |
public boolean | #upload(string$file) Uploads a file to the SFTP folder from the local folder Uploads a file to the SFTP folder from the local folder Parameters- $file
string $file File name
Returnsboolean
ThrowsAuthor |
public boolean | #makeFile(string$file,mixed$content) Creates a file in the SFTP directory Creates a file in the SFTP directory Parameters- $file
string $file File name- $content
mixed $content File content
Returnsboolean
ThrowsAuthor |
public boolean | #delete(string$item) Deletes an item on the SFTP server Deletes an item on the SFTP server Parameters- $item
string $item File or directory name
Returnsboolean
Author |
public string | #__toString( ) Returns a string representation of SFTP credentials Returns a string representation of SFTP credentials Returnsstring
Author |
publicAlo\SFTP | #url(string$url='') If no parameter is passed gets the SFTP server URL, otherwise sets it. If no parameter is passed gets the SFTP server URL, otherwise sets it. ParametersReturnsThrowsAuthor |
publicAlo\SFTP | #user(string$user='') If no parameter is passed gets the SFTP username, otherwise sets it. If no parameter is passed gets the SFTP username, otherwise sets it. Parameters- $user
string $user The username
ReturnsThrowsAuthor |
publicAlo\SFTP | #pubkey(string$pubkey='') Sets the SFTP public key path Sets the SFTP public key path Parameters- $pubkey
string $pubkey The path
ReturnsThrowsAuthor |
publicAlo\SFTP | #privkey(string$privkey='') If no parameter is passed gets the SFTP private key path, otherwise sets it If no parameter is passed gets the SFTP private key path, otherwise sets it Parameters- $privkey
string $privkey The path
ReturnsThrowsAuthor |
publicAlo\SFTP | #pw(string$pw='') If no parameter is passed gets the SFTP private key password, otherwise sets it If no parameter is passed gets the SFTP private key password, otherwise sets it Parameters- $pw
string $pw The password
ReturnsThrowsAuthor |
publicAlo\SFTP | #dir(mixed$dir= -1) If no argument is passed, gets the working directory, otherwise sets it. If no argument is passed, gets the working directory, otherwise sets it. ParametersReturnsThrowsAuthor |
public staticAlo\SFTP | $this | #Static reference to the last instance of the class Static reference to the last instance of the class |
protected string | $url | |
protected string | $user | |
protected string | $pubkey | #Path to the public authentication key Path to the public authentication key |
protected string | $privkey | #Path to the private authentication key Path to the private authentication key |
protected string | $pw | #Private authentication key password Private authentication key password |
protected string | $dir | |
protected resource | $connection | |
protected resource | $sftp | |
protected string | $localDir | |
protected integer | $retryCountMax | #Maximum amount of retries for an operation Maximum amount of retries for an operation |
protected integer | $retryTime | #Time in seconds between retries Time in seconds between retries |