public function TripalFieldDownloader::delete

3.x TripalFieldDownloader.inc public TripalFieldDownloader::delete()

Removes the downloadable file.

File

tripal/includes/TripalFieldDownloaders/TripalFieldDownloader.inc, line 218

Class

TripalFieldDownloader

Code

public function delete() {
  $fid = db_select('file_managed', 'fm')
    ->fields('fm', array('fid'))
    ->condition('uri', $this->outfile)
    ->execute()
    ->fetchField();
  if ($fid) {
    $file = file_load($fid);
    file_usage_delete($file, 'tripal', 'data-collection');
    file_delete($file, TRUE);
  }
}