You are here

public function video_ffmpeg::delete_job in Video 6.4

Same name and namespace in other branches
  1. 7 transcoders/video_ffmpeg.inc \video_ffmpeg::delete_job()

Overrides transcoder_interface::delete_job

File

transcoders/video_ffmpeg.inc, line 465

Class

video_ffmpeg

Code

public function delete_job($video) {
  if (!$this
    ->load_job($video->fid)) {
    return;
  }

  //lets get all our videos and unlink them
  $sql = db_query("SELECT data FROM {video_files} WHERE fid=%d", $video->fid);

  //we loop here as future development will include multiple video types (HTML 5)
  while ($row = db_fetch_object($sql)) {
    $data = unserialize($row->data);
    if (empty($data)) {
      continue;
    }
    foreach ($data as $file) {
      if (file_exists($file->filepath)) {
        unlink($file->filepath);
      }
    }
  }

  //now delete our rows.
  db_query('DELETE FROM {video_files} WHERE fid = %d', $video->fid);
}