function _auditfiles_not_in_database_format_row_data in Audit Files 7.3
Formats data about a file for adding to a table row.
Parameters
array $file: The name and path of the file, in an associative array.
string $real_path: The full system path to Drupal's "files" directory.
string $date_format: The specified system format to use when preparing a date.
Return value
array The file data, formatted for adding to a table row.
2 calls to _auditfiles_not_in_database_format_row_data()
- _auditfiles_not_in_database_batch_display_process_files in ./
auditfiles.notindatabase.inc - Retrieves file data from the database and checks if it is on the server.
- _auditfiles_not_in_database_get_reports_files in ./
auditfiles.notindatabase.inc - Recurse directories and add files to an array.
File
- ./
auditfiles.notindatabase.inc, line 950 - Generates a report showing files on the server, but not in the database.
Code
function _auditfiles_not_in_database_format_row_data(array $file, $real_path, $date_format) {
$filename = $file['file_name'];
$filepath = $file['path_from_files_root'];
if (empty($filepath)) {
$filepathname = $filename;
}
else {
$filepathname = $filepath . DIRECTORY_SEPARATOR . $filename;
}
$real_filepathname = $real_path . DIRECTORY_SEPARATOR . $filepathname;
$filemime = file_get_mimetype($real_filepathname);
$filesize = number_format(filesize($real_filepathname));
if (!empty($date_format)) {
$filemodtime = format_date(filemtime($real_filepathname), $date_format);
}
// Format the data for the table row.
$row_data[$filepathname] = array(
'filepathname' => empty($filepathname) ? '' : $filepathname,
'filemime' => empty($filemime) ? '' : $filemime,
'filesize' => !isset($filesize) ? '' : $filesize,
'filemodtime' => empty($filemodtime) ? '' : $filemodtime,
'filename' => empty($filename) ? '' : $filename,
);
return $row_data;
}