From f4e3bf734756919cd78c3638260b9d74c479f9b6 Mon Sep 17 00:00:00 2001 From: Liam Morland <liam@openplus.ca> Date: Mon, 5 Aug 2024 10:49:48 -0400 Subject: [PATCH] Issue #3466008: Replace FileSystemInterface::EXISTS_RENAME with FileExists::Rename --- src/OutputHandler.php | 3 ++- src/Plugin/PdfBackend/PdftkPdfBackend.php | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/OutputHandler.php b/src/OutputHandler.php index 60d22e7..e8e8bdf 100644 --- a/src/OutputHandler.php +++ b/src/OutputHandler.php @@ -2,6 +2,7 @@ namespace Drupal\fillpdf; +use Drupal\Core\File\FileExists; use Drupal\Core\File\FileSystemInterface; use Drupal\Core\StringTranslation\StringTranslationTrait; use Drupal\file\FileInterface; @@ -109,7 +110,7 @@ class OutputHandler implements OutputHandlerInterface { } else { // Full steam ahead! - $saved_file = $this->fileRepository->writeData($configuration['data'], "{$resolved_destination_path}/{$configuration['filename']}", FileSystemInterface::EXISTS_RENAME); + $saved_file = $this->fileRepository->writeData($configuration['data'], "{$resolved_destination_path}/{$configuration['filename']}", FileExists::Rename); $this->rememberFileContext($saved_file, $configuration['context']); } diff --git a/src/Plugin/PdfBackend/PdftkPdfBackend.php b/src/Plugin/PdfBackend/PdftkPdfBackend.php index 8af60ed..a3c401e 100644 --- a/src/Plugin/PdfBackend/PdftkPdfBackend.php +++ b/src/Plugin/PdfBackend/PdftkPdfBackend.php @@ -3,6 +3,7 @@ namespace Drupal\fillpdf\Plugin\PdfBackend; use Drupal\Core\Entity\EntityTypeManagerInterface; +use Drupal\Core\File\FileExists; use Drupal\Core\File\FileSystemInterface; use Drupal\Core\Plugin\ContainerFactoryPluginInterface; use Drupal\file\FileInterface; @@ -185,7 +186,7 @@ class PdftkPdfBackend extends PdfBackendBase implements ContainerFactoryPluginIn $xfdf_name = $template_uri . '.xfdf'; $xfdf = Xfdf::createString($fields, basename($xfdf_name)); // Generate the file. - $xfdf_file = \Drupal::service('file.repository')->writeData($xfdf, $xfdf_name, FileSystemInterface::EXISTS_RENAME); + $xfdf_file = \Drupal::service('file.repository')->writeData($xfdf, $xfdf_name, FileExists::Rename); // @todo Improve this approach when we turn $context into a value object. if (!isset($context['fid'])) { -- GitLab