You are here

public function drupal::delete_video in Video 6.5

Delete the video from the file system.

Overrides video_filesystem::delete_video

File

filesystem/drupal.inc, line 48
Definition of drupal.

Class

drupal

Code

public function delete_video(stdClass $video) {

  // The original file is deleted by the filefield module
  // Delete the locally converted videos
  if (!empty($video->data)) {
    foreach ($video->data as $file) {
      file_delete($file->filepath);
    }
  }

  // Delete our video thumbnails and folder.
  $thumb_folder = video_thumb_path($video, FALSE);

  // Recursively delete our folder and files.
  if (is_dir($thumb_folder)) {
    rmdirr($thumb_folder);

    // Delete any entries in the files table that may refer to the above path.
    db_query('DELETE FROM {files} WHERE filepath LIKE "%b%%"', strtr(db_escape_string($thumb_folder), array(
      '%' => '\\%',
      '_' => '\\_',
    )));
  }
}