DestinationBase.php in Backup and Migrate 5.0.x
File
src/Core/Destination/DestinationBase.php
View source
<?php
namespace Drupal\backup_migrate\Core\Destination;
use Drupal\backup_migrate\Core\Exception\DestinationNotWritableException;
use Drupal\backup_migrate\Core\Plugin\PluginBase;
use Drupal\backup_migrate\Core\File\BackupFileInterface;
use Drupal\backup_migrate\Core\File\BackupFileReadableInterface;
abstract class DestinationBase extends PluginBase implements ReadableDestinationInterface, WritableDestinationInterface {
public function supportedOps() {
return [];
}
public function saveFile(BackupFileReadableInterface $file) {
$this
->saveTheFile($file);
$this
->saveTheFileMetadata($file);
}
public function loadFileMetadata(BackupFileInterface $file) {
if (!$file
->getMeta('metadata_loaded')) {
$metadata = $this
->loadFileMetadataArray($file);
$file
->setMetaMultiple($metadata);
$file
->setMeta('metadata_loaded', TRUE);
}
return $file;
}
public function deleteFile($id) {
return $this
->deleteTheFile($id);
}
public function isRemote() {
return FALSE;
}
public function checkWritable() {
throw new DestinationNotWritableException('The specified destination cannot be written to.');
}
protected abstract function deleteTheFile($id);
protected abstract function saveTheFile(BackupFileReadableInterface $file);
protected abstract function saveTheFileMetadata(BackupFileInterface $file);
protected abstract function loadFileMetadataArray(BackupFileInterface $file);
}