37
37
38
38
use Composer \InstalledVersions ;
39
39
use Helhum \ConfigLoader \Config ;
40
- use Helhum \ConfigLoader \ConfigurationReaderFactory ;
41
40
use Helhum \ConfigLoader \PathDoesNotExistException ;
42
41
use Helhum \TYPO3 \ConfigHandling \ConfigCleaner ;
43
42
use Helhum \TYPO3 \ConfigHandling \ConfigDumper ;
44
- use Helhum \TYPO3 \ConfigHandling \ConfigExtractor ;
45
43
use Helhum \TYPO3 \ConfigHandling \ConfigLoader ;
46
44
use Helhum \TYPO3 \ConfigHandling \Processor \RemoveSettingsProcessor ;
47
45
use Helhum \TYPO3 \ConfigHandling \SettingsFiles ;
@@ -72,11 +70,6 @@ class ConfigurationManager
72
70
*/
73
71
private $ configLoader ;
74
72
75
- /**
76
- * @var ConfigExtractor
77
- */
78
- private $ configExtractor ;
79
-
80
73
/**
81
74
* @var ConfigDumper
82
75
*/
@@ -144,13 +137,11 @@ class ConfigurationManager
144
137
145
138
public function __construct (
146
139
ConfigLoader $ configLoader = null ,
147
- ConfigExtractor $ configExtractor = null ,
148
140
ConfigDumper $ configDumper = null ,
149
141
ConfigCleaner $ configCleaner = null
150
142
) {
151
143
$ this ->configLoader = $ configLoader ?: new ConfigLoader (Environment::getContext ()->isProduction ());
152
144
$ this ->configDumper = $ configDumper ?: new ConfigDumper ();
153
- $ this ->configExtractor = $ configExtractor ?: new ConfigExtractor ($ this ->configDumper );
154
145
$ this ->configCleaner = $ configCleaner ?: new ConfigCleaner ();
155
146
}
156
147
@@ -163,8 +154,6 @@ public function getDefaultConfiguration()
163
154
{
164
155
if (!$ this ->defaultConfig ) {
165
156
$ this ->defaultConfig = require $ this ->getDefaultConfigurationFileLocation ();
166
- // TYPO3 core expects this value to be set in LocalConfiguration.php (see SilentConfigurationUpgradeService::configureBackendLoginSecurity)
167
- unset($ this ->defaultConfig ['BE ' ]['loginSecurityLevel ' ]);
168
157
}
169
158
170
159
return $ this ->defaultConfig ;
@@ -201,7 +190,7 @@ public function getDefaultConfigurationDescriptionFileLocation()
201
190
*/
202
191
public function getLocalConfiguration ()
203
192
{
204
- return $ this ->configCleaner -> cleanConfig ( $ this -> getMergedLocalConfiguration (), $ this -> getDefaultConfiguration () );
193
+ return $ this ->configLoader -> loadOwn ( );
205
194
}
206
195
207
196
/**
@@ -294,17 +283,18 @@ public function updateLocalConfiguration(array $configurationToMerge): void
294
283
$ remainingPaths = array_diff ($ removedPaths , $ addedPaths );
295
284
$ this ->updateRemovalPaths ($ remainingPaths );
296
285
}
297
-
298
- if ($ this ->configExtractor ->extractConfig ($ configurationToMerge , $ this ->getMergedLocalConfiguration (), $ overrideSettingsFile )) {
299
- $ this ->configLoader ->flushCache ();
286
+ $ remainingConfigToWrite = $ this ->configCleaner ->cleanConfig (
287
+ $ configurationToMerge ,
288
+ $ this ->getLocalConfiguration ()
289
+ );
290
+ if (!empty ($ remainingConfigToWrite )) {
291
+ $ this ->configDumper ->dumpToFile (array_replace_recursive ($ this ->configLoader ->loadOverrides (), $ remainingConfigToWrite ), $ overrideSettingsFile );
300
292
}
301
293
}
302
294
303
295
private function findRemovedPaths (): array
304
296
{
305
- $ overrideSettingsFile = SettingsFiles::getOverrideSettingsFile ();
306
- $ factory = new ConfigurationReaderFactory ();
307
- $ overrides = file_exists ($ overrideSettingsFile ) ? $ factory ->createReader ($ overrideSettingsFile )->readConfig () : [];
297
+ $ overrides = $ this ->configLoader ->loadOverrides ();
308
298
$ removedPaths = [];
309
299
if (isset ($ overrides ['processors ' ])) {
310
300
foreach ($ overrides ['processors ' ] as $ index => $ processorConfig ) {
@@ -321,8 +311,7 @@ private function findRemovedPaths(): array
321
311
private function updateRemovalPaths (array $ pathsToRemove ): void
322
312
{
323
313
$ overrideSettingsFile = SettingsFiles::getOverrideSettingsFile ();
324
- $ factory = new ConfigurationReaderFactory ();
325
- $ overrides = file_exists ($ overrideSettingsFile ) ? $ factory ->createReader ($ overrideSettingsFile )->readConfig () : [];
314
+ $ overrides = $ this ->configLoader ->loadOverrides ();
326
315
$ processorPosition = 0 ;
327
316
if (isset ($ overrides ['processors ' ])) {
328
317
foreach ($ overrides ['processors ' ] as $ index => $ processorConfig ) {
@@ -497,7 +486,7 @@ public function exportConfiguration()
497
486
*/
498
487
public function writeLocalConfiguration (array $ configuration )
499
488
{
500
- $ configuration = $ this ->configCleaner ->cleanConfig ($ configuration , $ this ->getMergedLocalConfiguration ());
489
+ $ configuration = $ this ->configCleaner ->cleanConfig ($ configuration , $ this ->getLocalConfiguration ());
501
490
$ this ->updateLocalConfiguration ($ configuration );
502
491
503
492
// Too many places require this file to exist, so we make sure to create it
0 commit comments