You are here

public function FileSync::deleteFileExport in Tome 8

Deletes an exported file by entity.

Parameters

\Drupal\file\FileInterface $file: The file entity.

Overrides FileSyncInterface::deleteFileExport

File

modules/tome_sync/src/FileSync.php, line 86

Class

FileSync
Handles file import and exports by keeping a file export directory in sync.

Namespace

Drupal\tome_sync

Code

public function deleteFileExport(FileInterface $file) {
  $file_directory = $this
    ->getFileDirectory();
  if (strpos($file
    ->getFileUri(), 'public://') === 0) {
    $path = $this
      ->joinPaths($file_directory, StreamWrapperManager::getTarget($file
      ->getFileUri()));
    if (file_exists($path)) {
      $this->fileSystem
        ->delete($path);
    }
  }
}