From 693812356193d6de4e5d288b1cf3fddb6cc4839d Mon Sep 17 00:00:00 2001 From: Simon Baese Date: Thu, 30 Jun 2022 16:25:42 +0200 Subject: [PATCH] Add patch: Call image styles warmer batch operations statically --- composer.patches.json | 3 ++- ...e-styles-warmer-batch-ops-statically.patch | 22 +++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 patches/image_style_warmer/custom-call-image-styles-warmer-batch-ops-statically.patch diff --git a/composer.patches.json b/composer.patches.json index 19dd594c..c34b5324 100644 --- a/composer.patches.json +++ b/composer.patches.json @@ -48,7 +48,8 @@ }, "drupal/image_style_warmer": { "Custom: Validate image with GD toolkit": "patches/image_style_warmer/custom-validate-image-with-gd-toolkit.patch", - "Custom: Queue initial image styles during installation": "patches/image_style_warmer/custom-queue-initial-image-styles-during-installation.patch" + "Custom: Queue initial image styles during installation": "patches/image_style_warmer/custom-queue-initial-image-styles-during-installation.patch", + "Custom: Call image styles warmer batch operations statically": "patches/image_style_warmer/custom-call-image-styles-warmer-batch-ops-statically.patch" } } } diff --git a/patches/image_style_warmer/custom-call-image-styles-warmer-batch-ops-statically.patch b/patches/image_style_warmer/custom-call-image-styles-warmer-batch-ops-statically.patch new file mode 100644 index 00000000..094abef7 --- /dev/null +++ b/patches/image_style_warmer/custom-call-image-styles-warmer-batch-ops-statically.patch @@ -0,0 +1,22 @@ +diff --git a/modules/contrib/image_style_warmer/src/BatchService.php b/modules/contrib/image_style_warmer/src/BatchService.php +index edf34cda..7d48180a 100644 +--- a/modules/contrib/image_style_warmer/src/BatchService.php ++++ b/modules/contrib/image_style_warmer/src/BatchService.php +@@ -19,7 +19,7 @@ class BatchService { + * @param object $context + * Context for operations. + */ +- public function warmUpFileProcess($fid, $count, &$context) { ++ public static function warmUpFileProcess($fid, $count, &$context) { + /** @var \Drupal\image_style_warmer\ImageStylesWarmerInterface $image_styles_warmer */ + $image_styles_warmer = \Drupal::service('image_style_warmer.warmer'); + $file = File::load($fid); +@@ -45,7 +45,7 @@ public function warmUpFileProcess($fid, $count, &$context) { + * @param array $operations + * Array of operations. + */ +- public function warmUpFileFinished($success, array $results, array $operations) { ++ public static function warmUpFileFinished($success, array $results, array $operations) { + $messenger = \Drupal::messenger(); + if ($success) { + $messenger->addMessage(t('@count files warmed up.', ['@count' => count($results)]));