public function ServiceAuditFilesUsedNotManaged::auditfilesUsedNotManagedGetFileList in Audit Files 4.x
Same name and namespace in other branches
- 8.3 src/ServiceAuditFilesUsedNotManaged.php \Drupal\auditfiles\ServiceAuditFilesUsedNotManaged::auditfilesUsedNotManagedGetFileList()
- 8.2 src/ServiceAuditFilesUsedNotManaged.php \Drupal\auditfiles\ServiceAuditFilesUsedNotManaged::auditfilesUsedNotManagedGetFileList()
Retrieves the file IDs to operate on.
Return value
array The file IDs.
File
- src/
ServiceAuditFilesUsedNotManaged.php, line 62
Class
- ServiceAuditFilesUsedNotManaged
- Form for Files used not managed functionality.
Namespace
Drupal\auditfilesCode
public function auditfilesUsedNotManagedGetFileList() {
// Get all the file IDs in the file_usage table that are not in the
// file_managed table.
$connection = $this->connection;
$config = $this->configFactory
->get('auditfiles.settings');
$query = 'SELECT DISTINCT fid FROM {file_usage} fu WHERE fid NOT IN (SELECT fid FROM {file_managed})';
$maximum_records = $config
->get('auditfiles_report_options_maximum_records') ? $config
->get('auditfiles_report_options_maximum_records') : 250;
if ($maximum_records > 0) {
$query .= ' LIMIT ' . $maximum_records;
}
return $connection
->query($query)
->fetchCol();
}