You are here

protected function Transcoder::cleanConverted in Video 7.2

This helper function clean the database records if exist for current job.

1 call to Transcoder::cleanConverted()
Transcoder::executeConversion in includes/Transcoder.inc
This helper function will help to execute video conversion job by loading job from the database and once it completed saving its data in to the database.

File

includes/Transcoder.inc, line 259
Class file used to wrap the transcoder helper functions.

Class

Transcoder
@file Class file used to wrap the transcoder helper functions.

Code

protected function cleanConverted($fid) {
  $output_fids = db_select('video_output', 'vo')
    ->fields('vo', array(
    'output_fid',
  ))
    ->condition('original_fid', $fid)
    ->execute()
    ->fetchCol();
  if (empty($output_fids)) {
    return;
  }
  $output_files = file_load_multiple($output_fids);

  // Delete for all output files file_usage and file if not used anymore.
  foreach ($output_files as $output_file) {
    file_usage_delete($output_file, 'file');
    file_delete($output_file);
  }

  // Delete original_fid and all output_fid's from video_output table.
  db_delete('video_output')
    ->condition('original_fid', $fid)
    ->execute();
}