/** * Reset the video thumbnail to its original image as defined by the video provider. * @param File $file The video file to reset * @param string|null $thumbnailUrl * @param int $delayIndex Corresponds to a delay for a job to be queued up if we aren't * able to reset the thumbnail. This index corresponds to a class constant kept in the * ApiWrapper classes. * @return FileRepoStatus The status of the publish operation */ public function resetVideoThumb(File $file, $thumbnailUrl = null, $delayIndex = 0) { $mime = $file->getMimeType(); list(, $provider) = explode('/', $mime); $videoId = $file->getVideoId(); $title = $file->getTitle(); $oUploader = new VideoFileUploader(); $oUploader->setProvider($provider); $oUploader->setVideoId($videoId); $oUploader->setTargetTitle($title->getDBkey()); if (empty($thumbnailUrl)) { $thumbnailUrl = $oUploader->getApiWrapper()->getThumbnailUrl(); } $result = $oUploader->resetThumbnail($file, $thumbnailUrl, $delayIndex); if ($result->isGood()) { // update data and clear cache $status = $this->updateThumbnailData($file); if (!$status->isGood()) { $result->fatal($status->getMessage()); } } return $result; }