- $line_include_settings =
- '<?php include __DIR__ . "/settings.local.php"; ?>';
-
- if ($this->environment == 'dev') {
-
- // copy sites/example.settings.local.php sites/default/settings.local.php
- $this->fs->copy($this->local_settings_file_original, $this->local_settings_file, true);
-
- // uncomment cache bins in settings.local.php
- $this->maginot->unCommentLine(
- '# $settings[\'cache\'][\'bins\'][\'render\'] = \'cache.backend.null\';',
- $this->local_settings_file
- );
-
- $this->maginot->unCommentLine(
- '// $settings[\'cache\'][\'bins\'][\'render\'] = \'cache.backend.null\';',
- $this->local_settings_file
- );
-
- $this->maginot->unCommentLine(
- '# $settings[\'cache\'][\'bins\'][\'dynamic_page_cache\'] = \'cache.backend.null\';',
- $this->local_settings_file
- );
-
- $this->maginot->unCommentLine(
- '// $settings[\'cache\'][\'bins\'][\'dynamic_page_cache\'] = \'cache.backend.null\';',
- $this->local_settings_file
- );
-
- // include settings.local.php in settings.php
- // -- check first line if it is already this
- if ($this->maginot->getFirstLine($this->settings_file)!= $line_include_settings
- ) {
- chmod($this->settings_file, (int)0775);
- $this->maginot->setFirstLine(
- $line_include_settings,
- $this->settings_file
- );
- }
-
- $io->commentBlock(
- sprintf(
- '%s',
- $this->trans('commands.site.mode.messages.cachebins')
- )
- );
- }
- if ($this->environment == 'prod') {
- if (!$this->local) {
-
- // comment local.settings.php in settings.php
- if ($this->maginot->getFirstLine($this->settings_file)==$line_include_settings
- ) {
- $this->maginot->deleteFirstLine(
- $this->settings_file
- );
- }
-
-
- try {
- $this->fs->remove(
- $this->local_settings_file
- );
- //@TODO: msg user "local.settings.php deleted"
- } catch (IOExceptionInterface $e) {
- echo $e->getMessage();
- }
- } else {
-
- // comment cache bins in local.settings.php,
- // we still use local.settings.php for testing PROD
- // settings in local
-
- $this->maginot->CommentLine(
- ' $settings[\'cache\'][\'bins\'][\'render\'] = \'cache.backend.null\';',
- $this->local_settings_file
- );
-
- $this->maginot->CommentLine(
- ' $settings[\'cache\'][\'bins\'][\'dynamic_page_cache\'] = \'cache.backend.null\';',
- $this->local_settings_file
- );
- }
- }
-
- /**
- * would be better if this were replaced by $config->save?
- */
- //@TODO: 0444 should be a better permission for settings.php
- chmod($this->settings_file, (int)0644);
- //@TODO: 0555 should be a better permission for sites/default
- chmod($this->appRoot.'/sites/default/', (int)0755);
-