2 namespace TYPO3\CMS\Install\Service
;
5 * This file is part of the TYPO3 CMS project.
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
14 * The TYPO3 project - inspiring people to share!
17 use TYPO3\CMS\Core\Configuration\ConfigurationManager
;
18 use TYPO3\CMS\Core\Crypto\Random
;
19 use TYPO3\CMS\Core\Utility\ExtensionManagementUtility
;
20 use TYPO3\CMS\Core\Utility\GeneralUtility
;
21 use TYPO3\CMS\Install\Service\Exception\ConfigurationChangedException
;
24 * Execute "silent" LocalConfiguration upgrades if needed.
26 * Some LocalConfiguration settings are obsolete or changed over time.
27 * This class handles upgrades of these settings. It is called by
28 * the step controller at an early point.
30 * Every change is encapsulated in one method an must throw a ConfigurationChangedException
31 * if new data is written to LocalConfiguration. This is caught by above
32 * step controller to initiate a redirect and start again with adapted configuration.
34 class SilentConfigurationUpgradeService
37 * @var \TYPO3\CMS\Core\Configuration\ConfigurationManager
39 protected $configurationManager;
42 * List of obsolete configuration options in LocalConfiguration to be removed
49 protected $obsoleteLocalConfigurationSettings = [
51 'BE/spriteIconGenerator_handler',
57 'FE/formmailMaxAttachmentSize',
60 'SYS/t3lib_cs_convMethod',
62 'SYS/maxFileNameLength',
66 'BE/notificationPrefix',
71 'GFX/image_processing',
75 'SYS/curlProxyServer',
76 'SYS/curlProxyTunnel',
77 'SYS/curlProxyUserPass',
80 'BE/niceFlexFormXMLtags',
81 'BE/compactFlexFormXML',
83 'SYS/clearCacheSystem',
85 'SYS/caching/cacheConfigurations/extbase_typo3dbbackend_tablecolumns',
87 'SYS/caching/cacheConfigurations/extbase_typo3dbbackend_queries',
89 'FE/lockHashKeyWords',
90 'BE/lockHashKeyWords',
96 'FE/cHashIncludePageId',
98 'FE/noPHPscriptInclude',
99 'FE/maxSessionDataSize',
101 'SYS/enable_errorDLOG',
102 'SYS/enable_exceptionDLOG',
104 'EXT/allowSystemInstall',
109 'SYS/dbClientCompress',
111 'SYS/syslogErrorReporting',
114 'SC_OPTIONS/t3lib/class.t3lib_userauth.php/writeDevLog',
115 'SC_OPTIONS/t3lib/class.t3lib_userauth.php/writeDevLogBE',
116 'SC_OPTIONS/t3lib/class.t3lib_userauth.php/writeDevLogFE',
118 'SYS/enableDeprecationLog',
122 'FE/content_doktypes',
127 public function __construct(ConfigurationManager
$configurationManager = null)
129 $this->configurationManager
= $configurationManager ?
: GeneralUtility
::makeInstance(ConfigurationManager
::class);
133 * Executed configuration upgrades. Single upgrade methods must throw a
134 * ConfigurationChangedException if something was written to LocalConfiguration.
136 public function execute()
138 $this->generateEncryptionKeyIfNeeded();
139 $this->configureBackendLoginSecurity();
140 $this->migrateImageProcessorSetting();
141 $this->transferHttpSettings();
142 $this->disableImageMagickDetailSettingsIfImageMagickIsDisabled();
143 $this->setImageMagickDetailSettings();
144 $this->migrateThumbnailsPngSetting();
145 $this->migrateLockSslSetting();
146 $this->migrateDatabaseConnectionSettings();
147 $this->migrateDatabaseConnectionCharset();
148 $this->migrateDatabaseDriverOptions();
149 $this->migrateLangDebug();
150 $this->migrateCacheHashOptions();
151 $this->migrateExceptionErrors();
153 // Should run at the end to prevent that obsolete settings are removed before migration
154 $this->removeObsoleteLocalConfigurationSettings();
158 * Some settings in LocalConfiguration vanished in DefaultConfiguration
159 * and have no impact on the core anymore.
160 * To keep the configuration clean, those old settings are just silently
161 * removed from LocalConfiguration if set.
163 protected function removeObsoleteLocalConfigurationSettings()
165 $removed = $this->configurationManager
->removeLocalConfigurationKeysByPath($this->obsoleteLocalConfigurationSettings
);
167 // If something was changed: Trigger a reload to have new values in next request
169 $this->throwConfigurationChangedException();
174 * Backend login security is set to rsa if rsaauth
175 * is installed (but not used) otherwise the default value "normal" has to be used.
176 * This forces either 'normal' or 'rsa' to be set in LocalConfiguration.
178 protected function configureBackendLoginSecurity()
180 $rsaauthLoaded = ExtensionManagementUtility
::isLoaded('rsaauth');
182 $currentLoginSecurityLevelValue = $this->configurationManager
->getLocalConfigurationValueByPath('BE/loginSecurityLevel');
183 if ($rsaauthLoaded && $currentLoginSecurityLevelValue !== 'rsa') {
184 $this->configurationManager
->setLocalConfigurationValueByPath('BE/loginSecurityLevel', 'rsa');
185 $this->throwConfigurationChangedException();
186 } elseif (!$rsaauthLoaded && $currentLoginSecurityLevelValue !== 'normal') {
187 $this->configurationManager
->setLocalConfigurationValueByPath('BE/loginSecurityLevel', 'normal');
188 $this->throwConfigurationChangedException();
190 } catch (\RuntimeException
$e) {
191 // If an exception is thrown, the value is not set in LocalConfiguration
192 $this->configurationManager
->setLocalConfigurationValueByPath(
193 'BE/loginSecurityLevel',
194 $rsaauthLoaded ?
'rsa' : 'normal'
196 $this->throwConfigurationChangedException();
201 * The encryption key is crucial for securing form tokens
202 * and the whole TYPO3 link rendering later on. A random key is set here in
203 * LocalConfiguration if it does not exist yet. This might possible happen
204 * during upgrading and will happen during first install.
206 protected function generateEncryptionKeyIfNeeded()
209 $currentValue = $this->configurationManager
->getLocalConfigurationValueByPath('SYS/encryptionKey');
210 } catch (\RuntimeException
$e) {
211 // If an exception is thrown, the value is not set in LocalConfiguration
215 if (empty($currentValue)) {
216 $randomKey = GeneralUtility
::makeInstance(Random
::class)->generateRandomHexString(96);
217 $this->configurationManager
->setLocalConfigurationValueByPath('SYS/encryptionKey', $randomKey);
218 $this->throwConfigurationChangedException();
223 * Parse old curl and HTTP options and set new HTTP options, related to Guzzle
225 protected function transferHttpSettings()
229 $obsoleteParameters = [];
231 // Remove / migrate options to new options
233 // Check if the adapter option is set, if so, set it to the parameters that are obsolete
234 $this->configurationManager
->getLocalConfigurationValueByPath('HTTP/adapter');
235 $obsoleteParameters[] = 'HTTP/adapter';
236 } catch (\RuntimeException
$e) {
239 $newParameters['HTTP/version'] = $this->configurationManager
->getLocalConfigurationValueByPath('HTTP/protocol_version');
240 $obsoleteParameters[] = 'HTTP/protocol_version';
241 } catch (\RuntimeException
$e) {
244 $this->configurationManager
->getLocalConfigurationValueByPath('HTTP/ssl_verify_host');
245 $obsoleteParameters[] = 'HTTP/ssl_verify_host';
246 } catch (\RuntimeException
$e) {
249 $legacyUserAgent = $this->configurationManager
->getLocalConfigurationValueByPath('HTTP/userAgent');
250 $newParameters['HTTP/headers/User-Agent'] = $legacyUserAgent;
251 $obsoleteParameters[] = 'HTTP/userAgent';
252 } catch (\RuntimeException
$e) {
257 $legacyFollowRedirects = $this->configurationManager
->getLocalConfigurationValueByPath('HTTP/follow_redirects');
258 $obsoleteParameters[] = 'HTTP/follow_redirects';
259 } catch (\RuntimeException
$e) {
260 $legacyFollowRedirects = '';
263 $legacyMaximumRedirects = $this->configurationManager
->getLocalConfigurationValueByPath('HTTP/max_redirects');
264 $obsoleteParameters[] = 'HTTP/max_redirects';
265 } catch (\RuntimeException
$e) {
266 $legacyMaximumRedirects = '';
269 $legacyStrictRedirects = $this->configurationManager
->getLocalConfigurationValueByPath('HTTP/strict_redirects');
270 $obsoleteParameters[] = 'HTTP/strict_redirects';
271 } catch (\RuntimeException
$e) {
272 $legacyStrictRedirects = '';
275 // Check if redirects have been disabled
276 if ($legacyFollowRedirects !== '' && (bool)$legacyFollowRedirects === false) {
277 $newParameters['HTTP/allow_redirects'] = false;
278 } elseif ($legacyMaximumRedirects !== '' ||
$legacyStrictRedirects !== '') {
279 $newParameters['HTTP/allow_redirects'] = [];
280 if ($legacyMaximumRedirects !== '' && (int)$legacyMaximumRedirects !== 5) {
281 $newParameters['HTTP/allow_redirects']['max'] = (int)$legacyMaximumRedirects;
283 if ($legacyStrictRedirects !== '' && (bool)$legacyStrictRedirects === true) {
284 $newParameters['HTTP/allow_redirects']['strict'] = true;
286 // defaults are used, no need to set the option in LocalConfiguration.php
287 if (empty($newParameters['HTTP/allow_redirects'])) {
288 unset($newParameters['HTTP/allow_redirects']);
292 // Migrate Proxy settings
294 // Currently without protocol or port
295 $legacyProxyHost = $this->configurationManager
->getLocalConfigurationValueByPath('HTTP/proxy_host');
296 $obsoleteParameters[] = 'HTTP/proxy_host';
297 } catch (\RuntimeException
$e) {
298 $legacyProxyHost = '';
301 $legacyProxyPort = $this->configurationManager
->getLocalConfigurationValueByPath('HTTP/proxy_port');
302 $obsoleteParameters[] = 'HTTP/proxy_port';
303 } catch (\RuntimeException
$e) {
304 $legacyProxyPort = '';
307 $legacyProxyUser = $this->configurationManager
->getLocalConfigurationValueByPath('HTTP/proxy_user');
308 $obsoleteParameters[] = 'HTTP/proxy_user';
309 } catch (\RuntimeException
$e) {
310 $legacyProxyUser = '';
313 $legacyProxyPassword = $this->configurationManager
->getLocalConfigurationValueByPath('HTTP/proxy_password');
314 $obsoleteParameters[] = 'HTTP/proxy_password';
315 } catch (\RuntimeException
$e) {
316 $legacyProxyPassword = '';
318 // Auth Scheme: Basic, digest etc.
320 $legacyProxyAuthScheme = $this->configurationManager
->getLocalConfigurationValueByPath('HTTP/proxy_auth_scheme');
321 $obsoleteParameters[] = 'HTTP/proxy_auth_scheme';
322 } catch (\RuntimeException
$e) {
323 $legacyProxyAuthScheme = '';
326 if ($legacyProxyHost !== '') {
328 if ($legacyProxyAuthScheme !== '' && $legacyProxyUser !== '' && $legacyProxyPassword !== '') {
329 $proxy .= $legacyProxyUser . ':' . $legacyProxyPassword . '@';
331 $proxy .= $legacyProxyHost;
332 if ($legacyProxyPort !== '') {
333 $proxy .= ':' . $legacyProxyPort;
335 $newParameters['HTTP/proxy'] = $proxy;
339 // see http://docs.guzzlephp.org/en/latest/request-options.html#verify
341 $legacySslVerifyPeer = $this->configurationManager
->getLocalConfigurationValueByPath('HTTP/ssl_verify_peer');
342 $obsoleteParameters[] = 'HTTP/ssl_verify_peer';
343 } catch (\RuntimeException
$e) {
344 $legacySslVerifyPeer = '';
347 // Directory holding multiple Certificate Authority files
349 $legacySslCaPath = $this->configurationManager
->getLocalConfigurationValueByPath('HTTP/ssl_capath');
350 $obsoleteParameters[] = 'HTTP/ssl_capath';
351 } catch (\RuntimeException
$e) {
352 $legacySslCaPath = '';
354 // Certificate Authority file to verify the peer with (use when ssl_verify_peer is TRUE)
356 $legacySslCaFile = $this->configurationManager
->getLocalConfigurationValueByPath('HTTP/ssl_cafile');
357 $obsoleteParameters[] = 'HTTP/ssl_cafile';
358 } catch (\RuntimeException
$e) {
359 $legacySslCaFile = '';
361 if ($legacySslVerifyPeer !== '') {
362 if ($legacySslCaFile !== '' && $legacySslCaPath !== '') {
363 $newParameters['HTTP/verify'] = $legacySslCaPath . $legacySslCaFile;
364 } elseif ((bool)$legacySslVerifyPeer === false) {
365 $newParameters['HTTP/verify'] = false;
369 // SSL Key + Passphrase
370 // Name of a file containing local certificate
372 $legacySslLocalCert = $this->configurationManager
->getLocalConfigurationValueByPath('HTTP/ssl_local_cert');
373 $obsoleteParameters[] = 'HTTP/ssl_local_cert';
374 } catch (\RuntimeException
$e) {
375 $legacySslLocalCert = '';
378 // Passphrase with which local certificate was encoded
380 $legacySslPassphrase = $this->configurationManager
->getLocalConfigurationValueByPath('HTTP/ssl_passphrase');
381 $obsoleteParameters[] = 'HTTP/ssl_passphrase';
382 } catch (\RuntimeException
$e) {
383 $legacySslPassphrase = '';
386 if ($legacySslLocalCert !== '') {
387 if ($legacySslPassphrase !== '') {
388 $newParameters['HTTP/ssl_key'] = [
393 $newParameters['HTTP/ssl_key'] = $legacySslLocalCert;
397 // Update the LocalConfiguration file if obsolete parameters or new parameters are set
398 if (!empty($obsoleteParameters)) {
399 $this->configurationManager
->removeLocalConfigurationKeysByPath($obsoleteParameters);
402 if (!empty($newParameters)) {
403 $this->configurationManager
->setLocalConfigurationValuesByPathValuePairs($newParameters);
407 $this->throwConfigurationChangedException();
412 * Detail configuration of Image Magick settings must be cleared
413 * if Image Magick handling is disabled.
415 * "Configuration presets" in install tool is not type safe, so value
416 * comparisons here are not type safe too, to not trigger changes to
417 * LocalConfiguration again.
419 protected function disableImageMagickDetailSettingsIfImageMagickIsDisabled()
423 $currentImValue = $this->configurationManager
->getLocalConfigurationValueByPath('GFX/processor_enabled');
424 } catch (\RuntimeException
$e) {
425 $currentImValue = $this->configurationManager
->getDefaultConfigurationValueByPath('GFX/processor_enabled');
429 $currentImPathValue = $this->configurationManager
->getLocalConfigurationValueByPath('GFX/processor_path');
430 } catch (\RuntimeException
$e) {
431 $currentImPathValue = $this->configurationManager
->getDefaultConfigurationValueByPath('GFX/processor_path');
435 $currentImPathLzwValue = $this->configurationManager
->getLocalConfigurationValueByPath('GFX/processor_path_lzw');
436 } catch (\RuntimeException
$e) {
437 $currentImPathLzwValue = $this->configurationManager
->getDefaultConfigurationValueByPath('GFX/processor_path_lzw');
441 $currentImageFileExtValue = $this->configurationManager
->getLocalConfigurationValueByPath('GFX/imagefile_ext');
442 } catch (\RuntimeException
$e) {
443 $currentImageFileExtValue = $this->configurationManager
->getDefaultConfigurationValueByPath('GFX/imagefile_ext');
447 $currentThumbnailsValue = $this->configurationManager
->getLocalConfigurationValueByPath('GFX/thumbnails');
448 } catch (\RuntimeException
$e) {
449 $currentThumbnailsValue = $this->configurationManager
->getDefaultConfigurationValueByPath('GFX/thumbnails');
452 if (!$currentImValue) {
453 if ($currentImPathValue != '') {
454 $changedValues['GFX/processor_path'] = '';
456 if ($currentImPathLzwValue != '') {
457 $changedValues['GFX/processor_path_lzw'] = '';
459 if ($currentImageFileExtValue !== 'gif,jpg,jpeg,png') {
460 $changedValues['GFX/imagefile_ext'] = 'gif,jpg,jpeg,png';
462 if ($currentThumbnailsValue != 0) {
463 $changedValues['GFX/thumbnails'] = 0;
466 if (!empty($changedValues)) {
467 $this->configurationManager
->setLocalConfigurationValuesByPathValuePairs($changedValues);
468 $this->throwConfigurationChangedException();
473 * Detail configuration of Image Magick and Graphics Magick settings
474 * depending on main values.
476 * "Configuration presets" in install tool is not type safe, so value
477 * comparisons here are not type safe too, to not trigger changes to
478 * LocalConfiguration again.
480 protected function setImageMagickDetailSettings()
484 $currentProcessorValue = $this->configurationManager
->getLocalConfigurationValueByPath('GFX/processor');
485 } catch (\RuntimeException
$e) {
486 $currentProcessorValue = $this->configurationManager
->getDefaultConfigurationValueByPath('GFX/processor');
490 $currentProcessorMaskValue = $this->configurationManager
->getLocalConfigurationValueByPath('GFX/processor_allowTemporaryMasksAsPng');
491 } catch (\RuntimeException
$e) {
492 $currentProcessorMaskValue = $this->configurationManager
->getDefaultConfigurationValueByPath('GFX/processor_allowTemporaryMasksAsPng');
496 $currentProcessorEffectsValue = $this->configurationManager
->getLocalConfigurationValueByPath('GFX/processor_effects');
497 } catch (\RuntimeException
$e) {
498 $currentProcessorEffectsValue = $this->configurationManager
->getDefaultConfigurationValueByPath('GFX/processor_effects');
501 if ((string)$currentProcessorValue !== '') {
502 if ($currentProcessorMaskValue != 0) {
503 $changedValues['GFX/processor_allowTemporaryMasksAsPng'] = 0;
505 if ($currentProcessorValue === 'GraphicsMagick') {
506 if ($currentProcessorEffectsValue != -1) {
507 $changedValues['GFX/processor_effects'] = -1;
511 if (!empty($changedValues)) {
512 $this->configurationManager
->setLocalConfigurationValuesByPathValuePairs($changedValues);
513 $this->throwConfigurationChangedException();
518 * Migrate the definition of the image processor from the configuration value
519 * im_version_5 to the setting processor.
521 protected function migrateImageProcessorSetting()
523 $changedSettings = [];
524 $settingsToRename = [
525 'GFX/im' => 'GFX/processor_enabled',
526 'GFX/im_version_5' => 'GFX/processor',
527 'GFX/im_v5effects' => 'GFX/processor_effects',
528 'GFX/im_path' => 'GFX/processor_path',
529 'GFX/im_path_lzw' => 'GFX/processor_path_lzw',
530 'GFX/im_mask_temp_ext_gif' => 'GFX/processor_allowTemporaryMasksAsPng',
531 'GFX/im_noScaleUp' => 'GFX/processor_allowUpscaling',
532 'GFX/im_noFramePrepended' => 'GFX/processor_allowFrameSelection',
533 'GFX/im_stripProfileCommand' => 'GFX/processor_stripColorProfileCommand',
534 'GFX/im_useStripProfileByDefault' => 'GFX/processor_stripColorProfileByDefault',
535 'GFX/colorspace' => 'GFX/processor_colorspace',
538 foreach ($settingsToRename as $oldPath => $newPath) {
540 $value = $this->configurationManager
->getLocalConfigurationValueByPath($oldPath);
541 $this->configurationManager
->setLocalConfigurationValueByPath($newPath, $value);
542 $changedSettings[$oldPath] = true;
543 } catch (\RuntimeException
$e) {
544 // If an exception is thrown, the value is not set in LocalConfiguration
545 $changedSettings[$oldPath] = false;
549 if (!empty($changedSettings['GFX/im_version_5'])) {
550 $currentProcessorValue = $this->configurationManager
->getLocalConfigurationValueByPath('GFX/im_version_5');
551 $newProcessorValue = $currentProcessorValue === 'gm' ?
'GraphicsMagick' : 'ImageMagick';
552 $this->configurationManager
->setLocalConfigurationValueByPath('GFX/processor', $newProcessorValue);
555 if (!empty($changedSettings['GFX/im_noScaleUp'])) {
556 $currentProcessorValue = $this->configurationManager
->getLocalConfigurationValueByPath('GFX/im_noScaleUp');
557 $newProcessorValue = !$currentProcessorValue;
558 $this->configurationManager
->setLocalConfigurationValueByPath(
559 'GFX/processor_allowUpscaling',
564 if (!empty($changedSettings['GFX/im_noFramePrepended'])) {
565 $currentProcessorValue = $this->configurationManager
->getLocalConfigurationValueByPath('GFX/im_noFramePrepended');
566 $newProcessorValue = !$currentProcessorValue;
567 $this->configurationManager
->setLocalConfigurationValueByPath(
568 'GFX/processor_allowFrameSelection',
573 if (!empty($changedSettings['GFX/im_mask_temp_ext_gif'])) {
574 $currentProcessorValue = $this->configurationManager
->getLocalConfigurationValueByPath('GFX/im_mask_temp_ext_gif');
575 $newProcessorValue = !$currentProcessorValue;
576 $this->configurationManager
->setLocalConfigurationValueByPath(
577 'GFX/processor_allowTemporaryMasksAsPng',
582 if (!empty(array_filter($changedSettings))) {
583 $this->configurationManager
->removeLocalConfigurationKeysByPath(array_keys($changedSettings));
584 $this->throwConfigurationChangedException();
589 * Throw exception after configuration change to trigger a redirect.
591 * @throws ConfigurationChangedException
593 protected function throwConfigurationChangedException()
595 throw new ConfigurationChangedException(
596 'Configuration updated, reload needed',
602 * Migrate the configuration value thumbnails_png to a boolean value.
604 protected function migrateThumbnailsPngSetting()
608 $currentThumbnailsPngValue = $this->configurationManager
->getLocalConfigurationValueByPath('GFX/thumbnails_png');
609 } catch (\RuntimeException
$e) {
610 $currentThumbnailsPngValue = $this->configurationManager
->getDefaultConfigurationValueByPath('GFX/thumbnails_png');
613 if (is_int($currentThumbnailsPngValue) && $currentThumbnailsPngValue > 0) {
614 $changedValues['GFX/thumbnails_png'] = true;
616 if (!empty($changedValues)) {
617 $this->configurationManager
->setLocalConfigurationValuesByPathValuePairs($changedValues);
618 $this->throwConfigurationChangedException();
623 * Migrate the configuration setting BE/lockSSL to boolean if set in the LocalConfiguration.php file
625 protected function migrateLockSslSetting()
628 $currentOption = $this->configurationManager
->getLocalConfigurationValueByPath('BE/lockSSL');
629 // check if the current option is an integer/string and if it is active
630 if (!is_bool($currentOption) && (int)$currentOption > 0) {
631 $this->configurationManager
->setLocalConfigurationValueByPath('BE/lockSSL', true);
632 $this->throwConfigurationChangedException();
634 } catch (\RuntimeException
$e) {
635 // no change inside the LocalConfiguration.php found, so nothing needs to be modified
640 * Move the database connection settings to a "Default" connection
642 protected function migrateDatabaseConnectionSettings()
644 $confManager = $this->configurationManager
;
647 $removeSettings = [];
650 $value = $confManager->getLocalConfigurationValueByPath('DB/username');
651 $removeSettings[] = 'DB/username';
652 $newSettings['DB/Connections/Default/user'] = $value;
653 } catch (\RuntimeException
$e) {
654 // Old setting does not exist, do nothing
658 $value= $confManager->getLocalConfigurationValueByPath('DB/password');
659 $removeSettings[] = 'DB/password';
660 $newSettings['DB/Connections/Default/password'] = $value;
661 } catch (\RuntimeException
$e) {
662 // Old setting does not exist, do nothing
666 $value = $confManager->getLocalConfigurationValueByPath('DB/host');
667 $removeSettings[] = 'DB/host';
668 $newSettings['DB/Connections/Default/host'] = $value;
669 } catch (\RuntimeException
$e) {
670 // Old setting does not exist, do nothing
674 $value = $confManager->getLocalConfigurationValueByPath('DB/port');
675 $removeSettings[] = 'DB/port';
676 $newSettings['DB/Connections/Default/port'] = $value;
677 } catch (\RuntimeException
$e) {
678 // Old setting does not exist, do nothing
682 $value = $confManager->getLocalConfigurationValueByPath('DB/socket');
683 $removeSettings[] = 'DB/socket';
684 // Remove empty socket connects
685 if (!empty($value)) {
686 $newSettings['DB/Connections/Default/unix_socket'] = $value;
688 } catch (\RuntimeException
$e) {
689 // Old setting does not exist, do nothing
693 $value = $confManager->getLocalConfigurationValueByPath('DB/database');
694 $removeSettings[] = 'DB/database';
695 $newSettings['DB/Connections/Default/dbname'] = $value;
696 } catch (\RuntimeException
$e) {
697 // Old setting does not exist, do nothing
701 $value = (bool)$confManager->getLocalConfigurationValueByPath('SYS/dbClientCompress');
702 $removeSettings[] = 'SYS/dbClientCompress';
704 $newSettings['DB/Connections/Default/driverOptions'] = [
705 'flags' => MYSQLI_CLIENT_COMPRESS
,
708 } catch (\RuntimeException
$e) {
709 // Old setting does not exist, do nothing
713 $value = (bool)$confManager->getLocalConfigurationValueByPath('SYS/no_pconnect');
714 $removeSettings[] = 'SYS/no_pconnect';
716 $newSettings['DB/Connections/Default/persistentConnection'] = true;
718 } catch (\RuntimeException
$e) {
719 // Old setting does not exist, do nothing
723 $value = $confManager->getLocalConfigurationValueByPath('SYS/setDBinit');
724 $removeSettings[] = 'SYS/setDBinit';
725 $newSettings['DB/Connections/Default/initCommands'] = $value;
726 } catch (\RuntimeException
$e) {
727 // Old setting does not exist, do nothing
731 $confManager->getLocalConfigurationValueByPath('DB/Connections/Default/charset');
732 } catch (\RuntimeException
$e) {
733 // If there is no charset option yet, add it.
734 $newSettings['DB/Connections/Default/charset'] = 'utf8';
738 $confManager->getLocalConfigurationValueByPath('DB/Connections/Default/driver');
739 } catch (\RuntimeException
$e) {
740 // Use the mysqli driver by default if no value has been provided yet
741 $newSettings['DB/Connections/Default/driver'] = 'mysqli';
744 // Add new settings and remove old ones
745 if (!empty($newSettings)) {
746 $confManager->setLocalConfigurationValuesByPathValuePairs($newSettings);
748 if (!empty($removeSettings)) {
749 $confManager->removeLocalConfigurationKeysByPath($removeSettings);
752 // Throw redirect if something was changed
753 if (!empty($newSettings) ||
!empty($removeSettings)) {
754 $this->throwConfigurationChangedException();
759 * Migrate the configuration setting DB/Connections/Default/charset to 'utf8' as
760 * 'utf-8' is not supported by all MySQL versions.
762 protected function migrateDatabaseConnectionCharset()
764 $confManager = $this->configurationManager
;
766 $driver = $confManager->getLocalConfigurationValueByPath('DB/Connections/Default/driver');
767 $charset = $confManager->getLocalConfigurationValueByPath('DB/Connections/Default/charset');
768 if (in_array($driver, ['mysqli', 'pdo_mysql', 'drizzle_pdo_mysql'], true) && $charset === 'utf-8') {
769 $confManager->setLocalConfigurationValueByPath('DB/Connections/Default/charset', 'utf8');
770 $this->throwConfigurationChangedException();
772 } catch (\RuntimeException
$e) {
773 // no incompatible charset configuration found, so nothing needs to be modified
778 * Migrate the configuration setting DB/Connections/Default/driverOptions to array type.
780 protected function migrateDatabaseDriverOptions()
782 $confManager = $this->configurationManager
;
784 $options = $confManager->getLocalConfigurationValueByPath('DB/Connections/Default/driverOptions');
785 if (!is_array($options)) {
786 $confManager->setLocalConfigurationValueByPath(
787 'DB/Connections/Default/driverOptions',
788 ['flags' => (int)$options]
791 } catch (\RuntimeException
$e) {
792 // no driver options found, nothing needs to be modified
797 * Migrate the configuration setting BE/lang/debug if set in the LocalConfiguration.php file
799 protected function migrateLangDebug()
801 $confManager = $this->configurationManager
;
803 $currentOption = $confManager->getLocalConfigurationValueByPath('BE/lang/debug');
804 // check if the current option is set and boolean
805 if (isset($currentOption) && is_bool($currentOption)) {
806 $confManager->setLocalConfigurationValueByPath('BE/languageDebug', $currentOption);
808 } catch (\RuntimeException
$e) {
809 // no change inside the LocalConfiguration.php found, so nothing needs to be modified
814 * Migrate single cache hash related options under "FE" into "FE/cacheHash"
816 protected function migrateCacheHashOptions()
818 $confManager = $this->configurationManager
;
819 $removeSettings = [];
823 $value = $confManager->getLocalConfigurationValueByPath('FE/cHashOnlyForParameters');
824 $removeSettings[] = 'FE/cHashOnlyForParameters';
825 $newSettings['FE/cacheHash/cachedParametersWhiteList'] = GeneralUtility
::trimExplode(',', $value, true);
826 } catch (\RuntimeException
$e) {
830 $value = $confManager->getLocalConfigurationValueByPath('FE/cHashExcludedParameters');
831 $removeSettings[] = 'FE/cHashExcludedParameters';
832 $newSettings['FE/cacheHash/excludedParameters'] = GeneralUtility
::trimExplode(',', $value, true);
833 } catch (\RuntimeException
$e) {
837 $value = $confManager->getLocalConfigurationValueByPath('FE/cHashRequiredParameters');
838 $removeSettings[] = 'FE/cHashRequiredParameters';
839 $newSettings['FE/cacheHash/requireCacheHashPresenceParameters'] = GeneralUtility
::trimExplode(',', $value, true);
840 } catch (\RuntimeException
$e) {
844 $value = $confManager->getLocalConfigurationValueByPath('FE/cHashExcludedParametersIfEmpty');
845 $removeSettings[] = 'FE/cHashExcludedParametersIfEmpty';
846 if (trim($value) === '*') {
847 $newSettings['FE/cacheHash/excludeAllEmptyParameters'] = true;
849 $newSettings['FE/cacheHash/excludedParametersIfEmpty'] = GeneralUtility
::trimExplode(',', $value, true);
851 } catch (\RuntimeException
$e) {
854 // Add new settings and remove old ones
855 if (!empty($newSettings)) {
856 $confManager->setLocalConfigurationValuesByPathValuePairs($newSettings);
858 if (!empty($removeSettings)) {
859 $confManager->removeLocalConfigurationKeysByPath($removeSettings);
862 // Throw redirect if something was changed
863 if (!empty($newSettings) ||
!empty($removeSettings)) {
864 $this->throwConfigurationChangedException();
869 * Migrate SYS/exceptionalErrors to not contain E_USER_DEPRECATED
871 protected function migrateExceptionErrors()
873 $confManager = $this->configurationManager
;
875 $currentOption = (int)$confManager->getLocalConfigurationValueByPath('SYS/exceptionalErrors');
876 // make sure E_USER_DEPRECATED is not part of the exceptionalErrors
877 if ($currentOption & E_USER_DEPRECATED
) {
878 $confManager->setLocalConfigurationValueByPath('SYS/exceptionalErrors', $currentOption & ~E_USER_DEPRECATED
);
880 } catch (\RuntimeException
$e) {
881 // no change inside the LocalConfiguration.php found, so nothing needs to be modified