function FTP::factory
Same name in other branches
- 9 core/lib/Drupal/Core/FileTransfer/FTP.php \Drupal\Core\FileTransfer\FTP::factory()
- 8.9.x core/lib/Drupal/Core/FileTransfer/FTP.php \Drupal\Core\FileTransfer\FTP::factory()
- 10 core/lib/Drupal/Core/FileTransfer/FTP.php \Drupal\Core\FileTransfer\FTP::factory()
Overrides FileTransfer::factory
File
-
core/
lib/ Drupal/ Core/ FileTransfer/ FTP.php, line 24
Class
- FTP
- Defines the base class for FTP implementations.
Namespace
Drupal\Core\FileTransferCode
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);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.