function _auditfiles_not_in_database_batch_delete_process_file in Audit Files 7.3
Same name and namespace in other branches
- 7.4 auditfiles.notindatabase.inc \_auditfiles_not_in_database_batch_delete_process_file()
Deletes the specified file from the server.
Parameters
string $filename: The full pathname of the file to delete from the server.
1 call to _auditfiles_not_in_database_batch_delete_process_file()
- _auditfiles_not_in_database_batch_delete_process_batch in ./
auditfiles.notindatabase.inc - The batch process for deleting the file.
File
- ./
auditfiles.notindatabase.inc, line 665 - Generates a report showing files on the server, but not in the database.
Code
function _auditfiles_not_in_database_batch_delete_process_file($filename) {
// Get the static paths necessary for processing the files.
$file_system_stream = variable_get('auditfiles_file_system_path', 'public');
// The full file system path to the Drupal root directory.
$real_files_path = drupal_realpath($file_system_stream . '://');
// Delete the file without invoking any hooks.
if (file_unmanaged_delete($real_files_path . DIRECTORY_SEPARATOR . $filename)) {
drupal_set_message(t('Sucessfully deleted %file from the server.', array(
'%file' => $filename,
)));
// Remove the deleted files from the list of files to display.
$rows = variable_get('auditfiles_not_in_database_files_to_display', array());
unset($rows[$filename]);
variable_set('auditfiles_not_in_database_files_to_display', $rows);
}
else {
drupal_set_message(t('Failed to delete %file from the server.', array(
'%file' => $filename,
)));
}
}