TYPO3 ver. 6.x - additional configuration a.k.a. `localconf_local.php`

前端 未结 2 664
独厮守ぢ
独厮守ぢ 2020-12-16 17:49

What we need

In TYPO3 ver. 4.x we used to include additional configuration file for overwriting some settings (ie. DB credentials) by adding the include statement

相关标签:
2条回答
  • 2020-12-16 18:12

    Got it! :)

    The answer is: typo3conf/AdditionalConfiguration.php if this file exists it's included automatically, to overwrite some values we need to use well-known syntax ie.:

    <?php
    $GLOBALS['TYPO3_CONF_VARS']['DB']['database'] = 'my_local_database';
    $GLOBALS['TYPO3_CONF_VARS']['DB']['host']     = 'localhost';
    $GLOBALS['TYPO3_CONF_VARS']['DB']['username'] = 'username';
    $GLOBALS['TYPO3_CONF_VARS']['DB']['password'] = 'mypassword';
    ?>
    

    From "What's new" SlideShare (page 33)

    0 讨论(0)
  • 2020-12-16 18:33

    In addition to your own answer pay attention to a fact, that from 6.0 you shouldn't access TYPO3_CONF_VARS directly in your extension, but by getLocalConfigurationValueByPath('BE/loginSecurityLevel') and setLocalConfigurationValueByPath('BE/loginSecurityLevel', 'rsa') in \TYPO3\CMS\Core\Configuration\ConfigurationManager class.

    Taken from same "What's new" SlideShare page 35.

    UPDATE 15.06.15: Page 35 was included by accident to slides. Since TYPO3 6.2 ConfigurationManager is marked @internal. So, you shouldn't use ConfigurationManager in your own code. Details

    0 讨论(0)
提交回复
热议问题