You are here

public function FileProcessorTrait::alterMime in Backup and Migrate 8.4

Provide the file mime for the given file extension if known.

Parameters

string $filemime: The best guess so far for the file's mime type.

array $params: A list of parameters where 'ext' is the file extension we are testing.

Return value

string The mime type of the file (or the passed in mime type if unknown)

File

lib/backup_migrate_core/src/Plugin/FileProcessorTrait.php, line 52

Class

FileProcessorTrait
Class FileProcessorPluginTrait.

Namespace

BackupMigrate\Core\Plugin

Code

public function alterMime($filemime, $params) {

  // Check all of the provided file types for the given extension.
  if (method_exists($this, 'getFileTypes')) {
    $file_types = $this
      ->getFileTypes();
    foreach ($file_types as $info) {
      if (isset($info['extension']) && $info['extension'] == $params['ext'] && isset($info['filemime'])) {
        return $info['filemime'];
      }
    }
  }
  return $filemime;
}