You are here

function video_file_delete in Video 6.5

Same name and namespace in other branches
  1. 6.4 video.module \video_file_delete()
  2. 7.2 video.module \video_file_delete()
  3. 7 video.module \video_file_delete()

Implementation of hook_file_delete().

File

./video.module, line 360
Main file of the Video module.

Code

function video_file_delete($file) {
  $fid = intval($file->fid);
  if ($fid <= 0) {
    watchdog('video', 'video_file_delete called with empty argument', array(), WATCHDOG_ERROR);
    return;
  }

  // Let other modules to know about the file delete
  // before we delete the file, so the module has access to information in the database.
  video_module_invoke('delete', $file);

  // Delete the transcoder job and video
  $transcoder = video_get_transcoder();
  $video = $transcoder
    ->load_job($fid);
  $filesystem = video_get_filesystem();
  if ($video) {
    $transcoder
      ->delete_job($video);
    $filesystem
      ->delete_video($video);
  }
}