class DrupalBrowserUploadDestination in Backup and Migrate 5.0.x
@package Drupal\backup_migrate\Core\Destination
Hierarchy
- class \Drupal\backup_migrate\Core\Plugin\PluginBase implements ConfigurableInterface, PluginInterface uses ConfigurableTrait
- class \Drupal\backup_migrate\Drupal\Destination\DrupalBrowserUploadDestination implements ReadableDestinationInterface
Expanded class hierarchy of DrupalBrowserUploadDestination
1 file declares its use of DrupalBrowserUploadDestination
- backup_migrate.module in ./
backup_migrate.module - Primary hook implementations for Backup Migrate.
File
- src/
Drupal/ Destination/ DrupalBrowserUploadDestination.php, line 15
Namespace
Drupal\backup_migrate\Drupal\DestinationView source
class DrupalBrowserUploadDestination extends PluginBase implements ReadableDestinationInterface {
/**
* {@inheritdoc}
*/
public function getFile($id) {
$file_upload = \Drupal::request()->files
->get("files", NULL, TRUE)[$id];
// Make sure there's an upload to process.
if (!empty($file_upload)) {
$out = new ReadableStreamBackupFile($file_upload
->getRealPath());
$out
->setFullName($file_upload
->getClientOriginalName());
return $out;
}
}
/**
* Load the metadata for the given file however it may be stored.
*
* @param \Drupal\backup_migrate\Core\File\BackupFileInterface $file
*
* @return \Drupal\backup_migrate\Core\File\BackupFileInterface
*/
public function loadFileMetadata(BackupFileInterface $file) {
return $file;
}
/**
* Load the file with the given ID from the destination.
*
* @param \Drupal\backup_migrate\Core\File\BackupFileInterface $file
*
* @return \Drupal\backup_migrate\Core\File\BackupFileReadableInterface The file if it exists or NULL if it doesn't
*/
public function loadFileForReading(BackupFileInterface $file) {
return $file;
}
/**
* {@inheritdoc}
*/
public function fileExists($id) {
return (bool) \Drupal::request()->files
->has("files[{$id}]");
}
}
Members
Name![]() |
Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ConfigurableTrait:: |
protected | property | The object's configuration object. | |
ConfigurableTrait:: |
protected | property | The initial configuration. | |
ConfigurableTrait:: |
public | function | Get a specific value from the configuration. | |
ConfigurableTrait:: |
public | function | Get the configuration object for this item. | |
ConfigurableTrait:: |
public | function | Get the default values for the plugin. | 10 |
ConfigurableTrait:: |
public | function | Get any validation errors in the config. | |
ConfigurableTrait:: |
public | function | Get a default (blank) schema. | 10 |
ConfigurableTrait:: |
public | function | Set the configuration for all plugins. | 1 |
ConfigurableTrait:: |
public | function | 2 | |
DrupalBrowserUploadDestination:: |
public | function |
Does the file with the given id (filename) exist in this destination. Overrides ReadableDestinationInterface:: |
|
DrupalBrowserUploadDestination:: |
public | function |
Get a file object representing the file with the given ID from the dest. Overrides ReadableDestinationInterface:: |
|
DrupalBrowserUploadDestination:: |
public | function |
Load the file with the given ID from the destination. Overrides ReadableDestinationInterface:: |
|
DrupalBrowserUploadDestination:: |
public | function |
Load the metadata for the given file however it may be stored. Overrides ReadableDestinationInterface:: |
|
PluginBase:: |
public | function |
What is the weight of the given operation for this plugin. Overrides PluginInterface:: |
|
PluginBase:: |
public | function |
Get a list of supported operations and their weight. Overrides PluginInterface:: |
8 |
PluginBase:: |
public | function |
Does this plugin implement the given operation. Overrides PluginInterface:: |
|
TranslatableTrait:: |
protected | property | ||
TranslatableTrait:: |
public | function | ||
TranslatableTrait:: |
public | function | Translate the given string if there is a translator service available. |