From 72d1960624a9b05ac743e1223a821b5690eb4fb0 Mon Sep 17 00:00:00 2001
From: Ankit Pathak <1972-ankitv18@users.noreply.drupalcode.org>
Date: Mon, 15 Jul 2024 12:42:57 +0000
Subject: [PATCH] Issue #3460689: Unkown method writeWebConfig fix.

---
 src/Service/KeyGeneratorService.php | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/Service/KeyGeneratorService.php b/src/Service/KeyGeneratorService.php
index 0e48053..2e0dd3e 100755
--- a/src/Service/KeyGeneratorService.php
+++ b/src/Service/KeyGeneratorService.php
@@ -73,7 +73,12 @@ class KeyGeneratorService {
     $this->validator->validateNotFilePublicPath([$dir_path]);
 
     FileSecurity::writeHtaccess($dir_path);
-    FileSecurity::writeWebConfig($dir_path);
+    // As writeWebConfig method is deprecated and removed from D11.
+    // Also drupal dropped IIS support which require web.config so its ideal
+    // to have a check and handle the backward compatibility.
+    if (method_exists(FileSecurity::class, 'writeWebConfig')) {
+      FileSecurity::writeWebConfig($dir_path);
+    }
 
     // Create Keys array.
     $keys = KeyGenerator::generateKeys();
-- 
GitLab