You are here

protected function MediaMigrationDatabaseTrait::getMainMimeTypeExpression in Media Migration 8

Returns the main MIME type's expression for the current DB.

Parameters

\Drupal\Core\Database\Connection|null $connection: Database connection of the source Drupal 7 instance.

Return value

string The expression to get the main MIME type.

1 call to MediaMigrationDatabaseTrait::getMainMimeTypeExpression()
MediaMigrationDatabaseTrait::getFilePlainBaseQuery in src/Plugin/migrate/source/d7/MediaMigrationDatabaseTrait.php
Returns a base query for plain files.

File

src/Plugin/migrate/source/d7/MediaMigrationDatabaseTrait.php, line 107

Class

MediaMigrationDatabaseTrait
MediaMigrationDatabaseTrait.

Namespace

Drupal\media_migration\Plugin\migrate\source\d7

Code

protected function getMainMimeTypeExpression($connection = NULL) {
  $db = $connection ?? $this
    ->getDatabase();
  assert($db instanceof Connection);
  return $db instanceof SqLiteConnection ? "SUBSTRING(fm.filemime, 1, INSTR(fm.filemime, '/') - 1)" : "SUBSTRING(fm.filemime, 1, POSITION('/' IN fm.filemime) - 1)";
}