class FTP
Defines the base class for FTP implementations.
Hierarchy
- class \Drupal\Core\FileTransfer\FileTransfer uses \Drupal\Core\StringTranslation\StringTranslationTrait
- class \Drupal\Core\FileTransfer\FTP extends \Drupal\Core\FileTransfer\FileTransfer
Expanded class hierarchy of FTP
Deprecated
in drupal:11.2.0 and is removed from drupal:12.0.0. There is no replacement. Use composer to manage the code for your site.
See also
https://www.drupal.org/node/3512364
7 string references to 'FTP'
- core.services.yml in core/
core.services.yml - core/core.services.yml
- default.services.yml in sites/
default/ default.services.yml - sites/default/default.services.yml
- default.services.yml in core/
assets/ scaffold/ files/ default.services.yml - core/assets/scaffold/files/default.services.yml
- SystemHooks::filetransferInfo in core/
modules/ system/ src/ Hook/ SystemHooks.php - Implements hook_filetransfer_info().
- update_manager_file_get in core/
modules/ update/ update.manager.inc - Copies a file from the specified URL to the temporary directory for updates.
File
-
core/
lib/ Drupal/ Core/ FileTransfer/ FTP.php, line 14
Namespace
Drupal\Core\FileTransferView source
abstract class FTP extends FileTransfer {
/**
* {@inheritdoc}
*/
public function __construct($jail, $username, #[\SensitiveParameter] $password, $hostname, $port) {
@trigger_error(__CLASS__ . ' is deprecated in drupal:11.2.0 and is removed from drupal:12.0.0. There is no replacement. Use composer to manage the code for your site. See https://www.drupal.org/node/3512364', E_USER_DEPRECATED);
$this->username = $username;
$this->password = $password;
$this->hostname = $hostname;
$this->port = $port;
parent::__construct($jail);
}
/**
* {@inheritdoc}
*/
public 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);
}
/**
* {@inheritdoc}
*/
public function getSettingsForm() {
$form = parent::getSettingsForm();
$form['advanced']['port']['#default_value'] = 21;
return $form;
}
}
Members
| Title Sort descending | Modifiers | Object type | Summary | Overriden Title | Overrides |
|---|---|---|---|---|---|
| FileTransfer::$hostname | protected | property | The hostname for this file transfer. | ||
| FileTransfer::$jail | protected | property | Full path to directory where file-transfer is restricted to. | ||
| FileTransfer::$password | protected | property | The password for this file transfer. | 1 | |
| FileTransfer::$port | protected | property | The port for this file transfer. | 1 | |
| FileTransfer::$username | protected | property | The username for this file transfer. | 1 | |
| FileTransfer::checkPath | final protected | function | Checks that the path is inside the jail and throws an exception if not. | ||
| FileTransfer::chmod | final public | function | Changes the permissions of the specified $path (file or directory). | ||
| FileTransfer::connect | abstract public | function | Connects to the server. | 4 | |
| FileTransfer::copyDirectory | final public | function | Copies a directory. | ||
| FileTransfer::copyDirectoryJailed | protected | function | Copies a directory. | 1 | |
| FileTransfer::copyFile | final public | function | Copies a file. | ||
| FileTransfer::copyFileJailed | abstract protected | function | Copies a file. | 4 | |
| FileTransfer::createDirectory | final public | function | Creates a directory. | ||
| FileTransfer::createDirectoryJailed | abstract protected | function | Creates a directory. | 4 | |
| FileTransfer::findChroot | public | function | Returns the chroot property for this connection. | ||
| FileTransfer::fixRemotePath | final protected | function | Returns a modified path suitable for passing to the server. | ||
| FileTransfer::isDirectory | abstract public | function | Checks if a particular path is a directory. | 4 | |
| FileTransfer::isFile | abstract public | function | Checks if a particular path is a file (not a directory). | 4 | |
| FileTransfer::removeDirectory | final public | function | Removes a directory. | ||
| FileTransfer::removeDirectoryJailed | abstract protected | function | Removes a directory. | 4 | |
| FileTransfer::removeFile | final public | function | Removes a file. | ||
| FileTransfer::removeFileJailed | abstract protected | function | Removes a file. | 4 | |
| FileTransfer::sanitizePath | public | function | Changes backslashes to slashes, also removes a trailing slash. | ||
| FileTransfer::setChroot | public | function | Sets the chroot and changes the jail to match the correct path scheme. | ||
| FileTransfer::__get | public | function | Implements the magic __get() method. | ||
| FileTransfer::__isset | public | function | |||
| FileTransfer::__set | public | function | |||
| FileTransfer::__unset | public | function | |||
| FTP::factory | public static | function | Defines a factory method for this class. | Overrides FileTransfer::factory | |
| FTP::getSettingsForm | public | function | Returns a form to collect connection settings credentials. | Overrides FileTransfer::getSettingsForm | |
| FTP::__construct | public | function | Constructs a Drupal\Core\FileTransfer\FileTransfer object. | Overrides FileTransfer::__construct | 1 |
| StringTranslationTrait::$stringTranslation | protected | property | The string translation service. | 3 | |
| StringTranslationTrait::formatPlural | protected | function | Formats a string containing a count of items. | ||
| StringTranslationTrait::getNumberOfPlurals | protected | function | Returns the number of plurals supported by a given language. | ||
| StringTranslationTrait::getStringTranslation | protected | function | Gets the string translation service. | ||
| StringTranslationTrait::setStringTranslation | public | function | Sets the string translation service to use. | 2 | |
| StringTranslationTrait::t | protected | function | Translates a string to the current language or to a given language. | 1 |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.