public function ServiceAuditFilesUsedNotManaged::auditfilesUsedNotManagedGetFileList in Audit Files 8.2
Same name and namespace in other branches
- 8.3 src/ServiceAuditFilesUsedNotManaged.php \Drupal\auditfiles\ServiceAuditFilesUsedNotManaged::auditfilesUsedNotManagedGetFileList()
- 4.x 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 57
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');
$fm_query = $connection
->select('file_managed', 'fm')
->fields('fm', [
'fid',
])
->execute()
->fetchCol();
$query = $connection
->select('file_usage', 'fu')
->fields('fu', [
'fid',
]);
if (!empty($fm_query)) {
$query
->condition('fu.fid', $fm_query, 'NOT IN');
}
$maximum_records = $config
->get('auditfiles_report_options_maximum_records');
if ($maximum_records > 0) {
$query
->range(0, $maximum_records);
}
return $query
->execute()
->fetchCol();
}