You are here

private function BackupDatabaseFileHandler::createFileType in Backup Database 8

Determine the export type/ extension.

1 call to BackupDatabaseFileHandler::createFileType()
BackupDatabaseFileHandler::setupFile in src/BackupDatabaseFileHandler.php
Handles file generation.

File

src/BackupDatabaseFileHandler.php, line 139
Contains \Drupal\backup_db\BackupDatabaseFileHandler

Class

BackupDatabaseFileHandler
BackupDatabaseFileHandler class.

Namespace

Drupal\backup_db

Code

private function createFileType() {
  $type = 'application/octet-stream';
  $extension = '.sql';
  switch ($this->config['compress']) {
    case 'Gzip':
      $extension .= '.gz';
      $type = 'application/gzip';
      break;
    case 'Bzip2':
      $extension .= '.bz2';
      $type = 'application/x-bzip2';
  }
  $this->file
    ->setFileType($type);
  return $extension;
}