function _auditfiles_not_in_database_batch_display_process_files in Audit Files 7.3
Retrieves file data from the database and checks if it is on the server.
Parameters
array $context: Used by the Batch API to keep track of data and pass it from one operation to the next.
1 string reference to '_auditfiles_not_in_database_batch_display_process_files'
- _auditfiles_not_in_database_batch_display_get_operations in ./
auditfiles.notindatabase.inc - Configures the operations for the batch process.
File
- ./
auditfiles.notindatabase.inc, line 376 - Generates a report showing files on the server, but not in the database.
Code
function _auditfiles_not_in_database_batch_display_process_files(array &$context) {
if (empty($context['sandbox'])) {
$context['sandbox'] = array();
if (empty($context['results']['file_list'])) {
$context['sandbox']['progress'] = 1;
$context['sandbox']['max'] = 1;
}
else {
$context['sandbox']['progress'] = 0;
$context['sandbox']['max'] = count($context['results']['file_list']);
$context['sandbox']['date_format'] = variable_get('auditfiles_report_options_date_format', 'long');
// Get the path of the currently used file scheme.
$file_system_stream = variable_get('auditfiles_file_system_path', 'public');
$context['sandbox']['real_path'] = drupal_realpath($file_system_stream . '://');
}
}
if (empty($context['results']['files_to_display'])) {
$context['results']['files_to_display'] = array();
}
if (!empty($context['results']['file_list'])) {
$file_list = array_slice($context['results']['file_list'], 0, 20, TRUE);
foreach ($file_list as $file_id => $filepathname) {
// See if the file is in the database.
if (!_auditfiles_not_in_database_is_file_in_database($filepathname)) {
// The file is not in the database, so save the file information for the
// report.
$context['results']['files_to_display'][$filepathname] = _auditfiles_not_in_database_format_row_data($filepathname, $context['sandbox']['real_path'], $context['sandbox']['date_format']);
}
unset($context['results']['file_list'][$file_id]);
// Update the progress information.
$context['sandbox']['progress']++;
$context['message'] = t('Processing the file list. Processed file @num1 of @num2. Last file processed: !file_name.', array(
'@num1' => $context['sandbox']['progress'],
'@num2' => $context['sandbox']['max'],
'!file_name' => $file_id,
));
}
}
if ($context['sandbox']['progress'] != $context['sandbox']['max']) {
$context['finished'] = $context['sandbox']['progress'] >= $context['sandbox']['max'];
}
}