You are here

function _auditfiles_used_not_managed_get_file_data in Audit Files 7.3

Same name and namespace in other branches
  1. 7.4 auditfiles.usednotmanaged.inc \_auditfiles_used_not_managed_get_file_data()

Retrieves information about an individual file from the database.

Parameters

int $file_id: The ID of the file to prepare for display.

Return value

array The row for the table on the report, with the file's information formatted for display.

1 call to _auditfiles_used_not_managed_get_file_data()
auditfiles_used_not_managed_form in ./auditfiles.usednotmanaged.inc
Generates the report.

File

./auditfiles.usednotmanaged.inc, line 551
Generates a report showing files in file_usage, but not in file_managed.

Code

function _auditfiles_used_not_managed_get_file_data($file_id) {

  // Get the file information for the specified file ID from the database.
  $query = 'SELECT * FROM {file_usage} WHERE fid = ' . $file_id;
  $file = db_query($query)
    ->fetchObject();

  // Prepare the file information for displaying on the page. If the file exists
  // on the server, this will be an empty array, and it can be ignored.
  return array(
    'fid' => $file->fid,
    'module' => $file->module . ' ' . t('module'),
    'id' => l($file->type . '/' . $file->id, $file->type . '/' . $file->id),
    'count' => $file->count,
  );
}