/** * {@inheritDoc} */ public function removeFileFromPermanentDirectory(FileInterface $object) { try { $this->mediaFilesystem->delete($object->getFilePath()); } catch (FileNotFound $e) { } }
/** * Checks if file is modified by some other user * * @param FileInterface $entity * @param string $hash * @throws FileHashChangedException */ protected function checksum(FileInterface $entity) { $currentHash = $this->fileManager->checksumTemporaryFileByName($entity->getName()); if ($entity->getHash() !== $currentHash) { throw new FileHashChangedException($entity->getName()); } }
/** * Return download url * * @param FileInterface $file * @return string */ public function generateDownloadUrl(FileInterface $file) { return $this->container->get('router')->generate('thrace_media_file_download', array('filepath' => $file->getFilePath(), 'filename' => $file->getOriginalName()), true); }