From 9efd5b57485b8e9b6b515b7bebdd3542d2a809a7 Mon Sep 17 00:00:00 2001
From: Helmut Hummel <typo3@helhum.io>
Date: Sat, 15 Jun 2024 21:41:02 +0200
Subject: [PATCH] [TASK] Revert "Prevent requiring "typo3conf" for Composer
 mode in Dir. Status"

This reverts commit 4b89b371d0f013b365bdffe7eec24689db9896f4.

Reason for revert: The typo3conf folder is still used
by the backend:lock and backend:unlock cli commands
and the corresponding backend locking functionality

Releases: 12.4
Resolves: #104119
Related: #104074
Change-Id: I37a658b7123aaf3b015a8982efbb4af72b9ec1f0
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/84649
Tested-by: Garvin Hicking <gh@faktor-e.de>
Tested-by: Benni Mack <benni@typo3.org>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Garvin Hicking <gh@faktor-e.de>
Reviewed-by: Benni Mack <benni@typo3.org>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: core-ci <typo3@b13.com>
---
 .../FolderStructure/DefaultFactory.php        | 70 +++++++++----------
 .../Classes/Report/InstallStatusReport.php    |  3 +-
 2 files changed, 33 insertions(+), 40 deletions(-)

diff --git a/typo3/sysext/install/Classes/FolderStructure/DefaultFactory.php b/typo3/sysext/install/Classes/FolderStructure/DefaultFactory.php
index e682cddbbc02..97e941706520 100644
--- a/typo3/sysext/install/Classes/FolderStructure/DefaultFactory.php
+++ b/typo3/sysext/install/Classes/FolderStructure/DefaultFactory.php
@@ -98,6 +98,33 @@ class DefaultFactory
                             ],
                         ],
                     ],
+                    [
+                        'name' => 'typo3conf',
+                        'type' => DirectoryNode::class,
+                        'targetPermission' => $directoryPermission,
+                        'children' => [
+                            [
+                                'name' => 'ext',
+                                'type' => DirectoryNode::class,
+                                'targetPermission' => $directoryPermission,
+                            ],
+                            [
+                                'name' => 'l10n',
+                                'type' => DirectoryNode::class,
+                                'targetPermission' => $directoryPermission,
+                            ],
+                            [
+                                'name' => 'sites',
+                                'type' => DirectoryNode::class,
+                                'targetPermission' => $directoryPermission,
+                            ],
+                            [
+                                'name' => 'system',
+                                'type' => DirectoryNode::class,
+                                'targetPermission' => $directoryPermission,
+                            ],
+                        ],
+                    ],
                     $this->getFileadminStructure(),
                 ],
             ];
@@ -118,36 +145,6 @@ class DefaultFactory
                     'targetContentFile' => self::TEMPLATE_PATH . '/root-web-config',
                 ];
             }
-
-            if (!Environment::isComposerMode()) {
-                $structure['children'][] = [
-                    'name' => 'typo3conf',
-                    'type' => DirectoryNode::class,
-                    'targetPermission' => $directoryPermission,
-                    'children' => [
-                        [
-                            'name' => 'ext',
-                            'type' => DirectoryNode::class,
-                            'targetPermission' => $directoryPermission,
-                        ],
-                        [
-                            'name' => 'l10n',
-                            'type' => DirectoryNode::class,
-                            'targetPermission' => $directoryPermission,
-                        ],
-                        [
-                            'name' => 'sites',
-                            'type' => DirectoryNode::class,
-                            'targetPermission' => $directoryPermission,
-                        ],
-                        [
-                            'name' => 'system',
-                            'type' => DirectoryNode::class,
-                            'targetPermission' => $directoryPermission,
-                        ],
-                    ],
-                ];
-            }
         } else {
             // This is when the public path is a subfolder (e.g. public/ or web/)
             $publicPath = substr(Environment::getPublicPath(), strlen(Environment::getProjectPath()) + 1);
@@ -167,6 +164,11 @@ class DefaultFactory
                         $this->getTemporaryAssetsFolderStructure(),
                     ],
                 ],
+                [
+                    'name' => 'typo3conf',
+                    'type' => DirectoryNode::class,
+                    'targetPermission' => $directoryPermission,
+                ],
                 $this->getFileadminStructure(),
             ];
 
@@ -187,14 +189,6 @@ class DefaultFactory
                 ];
             }
 
-            if (!Environment::isComposerMode()) {
-                $publicPathSubStructure[] = [
-                    'name' => 'typo3conf',
-                    'type' => DirectoryNode::class,
-                    'targetPermission' => $directoryPermission,
-                ];
-            }
-
             $structure = [
                 // Note that root node has no trailing slash like all others
                 'name' => Environment::getProjectPath(),
diff --git a/typo3/sysext/install/Classes/Report/InstallStatusReport.php b/typo3/sysext/install/Classes/Report/InstallStatusReport.php
index 94117ce5ca20..c44c3c263269 100644
--- a/typo3/sysext/install/Classes/Report/InstallStatusReport.php
+++ b/typo3/sysext/install/Classes/Report/InstallStatusReport.php
@@ -91,6 +91,7 @@ final class InstallStatusReport implements StatusProviderInterface
             $varPath . '/transient/' => 2,
             $varPath . '/charset/' => 2,
             $varPath . '/lock/' => 2,
+            $sitePath . '/typo3conf/' => 2,
             Environment::getLabelsPath() => 0,
             $sitePath . '/' . $GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir'] => -1,
             $sitePath . '/' . $GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir'] . '_temp_/' => 0,
@@ -99,8 +100,6 @@ final class InstallStatusReport implements StatusProviderInterface
         // Check for writable extension folder files in non-composer mode only
         if (!Environment::isComposerMode()) {
             $checkWritable[Environment::getExtensionsPath()] = 0;
-            $checkWritable[$sitePath . '/typo3conf/'] = 2;
-
         }
 
         foreach ($checkWritable as $path => $requirementLevel) {
-- 
GitLab