protected function MediaMigrationDatabaseTrait::getExtensionExpression in Media Migration 8
Returns the file extension 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 for getting the file extension.
2 calls to MediaMigrationDatabaseTrait::getExtensionExpression()
- FileEntitySourceFieldInstance::query in src/
Plugin/ migrate/ source/ d7/ FileEntitySourceFieldInstance.php - FilePlainSourceFieldInstance::query in src/
Plugin/ migrate/ source/ d7/ FilePlainSourceFieldInstance.php
File
- src/
Plugin/ migrate/ source/ d7/ MediaMigrationDatabaseTrait.php, line 124
Class
- MediaMigrationDatabaseTrait
- MediaMigrationDatabaseTrait.
Namespace
Drupal\media_migration\Plugin\migrate\source\d7Code
protected function getExtensionExpression($connection = NULL) {
$db = $connection ?? $this
->getDatabase();
assert($db instanceof Connection);
return $db instanceof SqLiteConnection ? "REPLACE(fm.uri, RTRIM(fm.uri, REPLACE(fm.uri, '.', '')), '')" : "SUBSTRING(fm.uri FROM CHAR_LENGTH(fm.uri) - POSITION('.' IN REVERSE(fm.uri)) + 2)";
}