You are here

function ServiceAuditFilesNotOnServer::_auditfiles_not_on_server_batch_delete_process_file in Audit Files 8

Deletes the specified file from the database.

Parameters

int $file_id: The ID of the file to delete from the database.

File

src/ServiceAuditFilesNotOnServer.php, line 140
providing the service that used in not in database functionality.

Class

ServiceAuditFilesNotOnServer

Namespace

Drupal\auditfiles

Code

function _auditfiles_not_on_server_batch_delete_process_file($file_id) {
  $connection = Database::getConnection();
  $num_rows = $connection
    ->delete('file_managed')
    ->condition('fid', $file_id)
    ->execute();
  if (empty($num_rows)) {
    drupal_set_message(t('There was a problem deleting the record with file ID %fid from the file_managed table. Check the logs for more information.', [
      '%fid' => $file_id,
    ]), 'warning');
  }
  else {
    drupal_set_message(t('Sucessfully deleted File ID : %fid from the file_managed table.', [
      '%fid' => $file_id,
    ]));
  }
}