class Ftp in Flysystem 7
Same name and namespace in other branches
- 8 src/Flysystem/Ftp.php \Drupal\flysystem\Flysystem\Ftp
- 3.x src/Flysystem/Ftp.php \Drupal\flysystem\Flysystem\Ftp
- 2.0.x src/Flysystem/Ftp.php \Drupal\flysystem\Flysystem\Ftp
- 3.0.x src/Flysystem/Ftp.php \Drupal\flysystem\Flysystem\Ftp
Drupal plugin for the "FTP" Flysystem adapter.
Hierarchy
- class \Drupal\flysystem\Plugin\FlysystemPluginBase implements FlysystemPluginInterface
- class \Drupal\flysystem\Flysystem\Ftp
Expanded class hierarchy of Ftp
File
- src/
Flysystem/ Ftp.php, line 17 - Contains \Drupal\flysystem\Flysystem\Ftp.
Namespace
Drupal\flysystem\FlysystemView source
class Ftp extends FlysystemPluginBase {
/**
* Plugin configuration.
*
* @var array
*/
protected $configuration;
/**
* Constructs an Ftp object.
*
* @param array $configuration
* Plugin configuration array.
*/
public function __construct(array $configuration) {
$this->configuration = $configuration;
if (empty($this->configuration['host'])) {
$this->configuration['host'] = '127.0.0.1';
}
}
/**
* {@inheritdoc}
*/
public function getAdapter() {
try {
$adapter = new FtpAdapter($this->configuration);
$adapter
->connect();
} catch (\RuntimeException $e) {
// A problem connecting to the server.
$adapter = new MissingAdapter();
}
return $adapter;
}
/**
* {@inheritdoc}
*/
public function ensure($force = FALSE) {
if ($this
->getAdapter() instanceof FtpAdapter) {
return array();
}
return array(
array(
'severity' => WATCHDOG_ERROR,
'message' => 'There was an error connecting to the FTP server %host:%port.',
'context' => array(
'%host' => $this->configuration['host'],
'%port' => isset($this->configuration['port']) ? $this->configuration['port'] : 21,
),
),
);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
FlysystemPluginBase:: |
public static | function |
Creates a new plugin instance. Overrides FlysystemPluginInterface:: |
1 |
FlysystemPluginBase:: |
public | function |
Returns a web accessible URL for the resource. Overrides FlysystemPluginInterface:: |
2 |
FlysystemPluginBase:: |
protected | function | Returns the scheme from the internal URI. | |
FlysystemPluginBase:: |
protected | function | Returns the target file path of a URI. | |
Ftp:: |
protected | property | Plugin configuration. | |
Ftp:: |
public | function | ||
Ftp:: |
public | function |
Returns the Flysystem adapter Overrides FlysystemPluginInterface:: |
|
Ftp:: |
public | function | Constructs an Ftp object. |