Defines the base class for FTP implementations.
Expanded class hierarchy of FTP
abstract class FTP extends FileTransfer {
/**
* Overrides Drupal\Core\FileTransfer\FileTransfer::__construct().
*/
public function __construct($jail, $username, $password, $hostname, $port) {
$this->username = $username;
$this->password = $password;
$this->hostname = $hostname;
$this->port = $port;
parent::__construct($jail);
}
/**
* Overrides Drupal\Core\FileTransfer\FileTransfer::factory().
*/
static function factory($jail, $settings) {
$username = empty($settings['username']) ? '' : $settings['username'];
$password = empty($settings['password']) ? '' : $settings['password'];
$hostname = empty($settings['advanced']['hostname']) ? 'localhost' : $settings['advanced']['hostname'];
$port = empty($settings['advanced']['port']) ? 21 : $settings['advanced']['port'];
if (function_exists('ftp_connect')) {
$class = 'Drupal\\Core\\FileTransfer\\FTPExtension';
}
else {
throw new FileTransferException('No FTP backend available.');
}
return new $class($jail, $username, $password, $hostname, $port);
}
/**
* Overrides Drupal\Core\FileTransfer\FileTransfer::getSettingsForm().
*/
public function getSettingsForm() {
$form = parent::getSettingsForm();
$form['advanced']['port']['#default_value'] = 21;
return $form;
}
}
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
FileTransfer:: |
protected | property | The hostname for this file transfer. | |
FileTransfer:: |
protected | property | The password for this file transfer. | 1 |
FileTransfer:: |
protected | property | The port for this file transfer. | 1 |
FileTransfer:: |
protected | property | The username for this file transfer. | 1 |
FileTransfer:: |
final protected | function | Checks that the path is inside the jail and throws an exception if not. | |
FileTransfer:: |
final public | function | Changes the permissions of the specified $path (file or directory). | |
FileTransfer:: |
abstract protected | function | Connects to the server. | 4 |
FileTransfer:: |
final public | function | Copies a directory. | |
FileTransfer:: |
protected | function | Copies a directory. | 1 |
FileTransfer:: |
final public | function | Copies a file. | |
FileTransfer:: |
abstract protected | function | Copies a file. | 4 |
FileTransfer:: |
final public | function | Creates a directory. | |
FileTransfer:: |
abstract protected | function | Creates a directory. | 4 |
FileTransfer:: |
function | Returns the chroot property for this connection. | ||
FileTransfer:: |
final protected | function | Returns a modified path suitable for passing to the server. | |
FileTransfer:: |
abstract public | function | Checks if a particular path is a directory. | 4 |
FileTransfer:: |
abstract public | function | Checks if a particular path is a file (not a directory). | 4 |
FileTransfer:: |
final public | function | Removes a directory. | |
FileTransfer:: |
abstract protected | function | Removes a directory. | 4 |
FileTransfer:: |
final public | function | Removes a file. | |
FileTransfer:: |
abstract protected | function | Removes a file. | 4 |
FileTransfer:: |
function | Changes backslashes to slashes, also removes a trailing slash. | ||
FileTransfer:: |
function | Sets the chroot and changes the jail to match the correct path scheme. | ||
FileTransfer:: |
function | Implements the magic __get() method. | ||
FTP:: |
static | function |
Overrides Drupal\Core\FileTransfer\FileTransfer::factory(). Overrides FileTransfer:: |
|
FTP:: |
public | function |
Overrides Drupal\Core\FileTransfer\FileTransfer::getSettingsForm(). Overrides FileTransfer:: |
|
FTP:: |
public | function |
Overrides Drupal\Core\FileTransfer\FileTransfer::__construct(). Overrides FileTransfer:: |