You are here

protected function MediaMigrationDatabaseTrait::getSchemeExpression in Media Migration 8

Returns the expression for the DB for getting the URI scheme.

Parameters

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

Return value

string The expression for the DB for getting the URI scheme.

2 calls to MediaMigrationDatabaseTrait::getSchemeExpression()
MediaMigrationDatabaseTrait::getFileEntityBaseQuery in src/Plugin/migrate/source/d7/MediaMigrationDatabaseTrait.php
Returns a base query for file entity types.
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 90

Class

MediaMigrationDatabaseTrait
MediaMigrationDatabaseTrait.

Namespace

Drupal\media_migration\Plugin\migrate\source\d7

Code

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