protected function MediaMigrationDatabaseTrait::getFilePlainBaseQuery in Media Migration 8
Returns a base query for plain files.
Parameters
\Drupal\Core\Database\Connection|null $connection: Database connection of the source Drupal 7 instance.
bool $distinct: Base query should use distinct.
Return value
\Drupal\Core\Database\Query\SelectInterface The base query.
2 calls to MediaMigrationDatabaseTrait::getFilePlainBaseQuery()
- FilePlain::query in src/
Plugin/ migrate/ source/ d7/ FilePlain.php - FilePlainConfigSourceBase::query in src/
Plugin/ migrate/ source/ d7/ FilePlainConfigSourceBase.php
File
- src/
Plugin/ migrate/ source/ d7/ MediaMigrationDatabaseTrait.php, line 25
Class
- MediaMigrationDatabaseTrait
- MediaMigrationDatabaseTrait.
Namespace
Drupal\media_migration\Plugin\migrate\source\d7Code
protected function getFilePlainBaseQuery($connection = NULL, bool $distinct = TRUE) {
$db = $connection ?? $this
->getDatabase();
assert($db instanceof Connection);
$options = [
'fetch' => \PDO::FETCH_ASSOC,
];
$query = $db
->select('file_managed', 'fm', $options);
$query
->distinct($distinct);
$query
->condition('fm.status', TRUE);
$query
->addExpression($this
->getSchemeExpression($db), 'scheme');
$query
->addExpression($this
->getMainMimeTypeExpression($db), 'mime');
$query
->where("{$this->getSchemeExpression($db)} <> 'temporary'");
// Omit all files that are used solely for a user picture and/or in webform
// submission: they do not belong in Drupal's media library.
$query
->condition('fm.fid', $this
->getUserPictureOnlyFidsQuery($db), 'NOT IN');
$query
->condition('fm.fid', $this
->getWebformOrUserPictureOnlyFidsQuery($db), 'NOT IN');
return $query;
}