public function setupDrupalSettings()
    {
        $this->_copy(
            "{$this->sitesPath}/default/default.settings.php",
            $this->settingFile
        );
        $install_root = dirname($this->getQualifiedInstallRoot());

        if ($this->getProjectVersion() >= 8) {
            $this->taskWriteToFile("{$install_root}/salt.txt")
                ->line(Utility::randomHash())
                ->run();

            $this->taskFilesystemStack()
                ->mkdir("{$install_root}/config", 0775)
                ->chmod("{$install_root}/salt.txt", 0775)
                ->run();

            $this->taskWriteToFile($this->settingFile)
                ->append()
                ->regexReplace(
                    '/\#\sif.+\/settings\.local\.php.+\n#.+\n\#\s}/',
                    $this->drupalSettingsLocalInclude()
                )
                ->replace(
                    '$config_directories = array();',
                    '$config_directories[CONFIG_SYNC_DIRECTORY] = dirname(DRUPAL_ROOT) . \'/config\';'
                )
                ->replace(
                    '$settings[\'hash_salt\'] = \'\';',
                    '$settings[\'hash_salt\'] = file_get_contents(dirname(DRUPAL_ROOT) . \'/salt.txt\');'
                )
                ->run();
        }

        return $this;
    }
public function setupDrupalSettings()
    {
        $this->_copy(
            "{$this->sitesPath}/default/default.settings.php",
            $this->settingFile
        );
        $install_root = dirname($this->getQualifiedInstallRoot());

        if ($this->getProjectVersion() >= 8) {
            $this->taskWriteToFile("{$install_root}/salt.txt")
                ->line(Utility::randomHash())
                ->run();

            $this->taskFilesystemStack()
                ->mkdir("{$install_root}/config", 0775)
                ->chmod("{$install_root}/salt.txt", 0775)
                ->run();

            $this->taskWriteToFile($this->settingFile)
                ->append()
                ->regexReplace(
                    '/\#\sif.+\/settings\.local\.php.+\n#.+\n\#\s}/',
                    $this->drupalSettingsLocalInclude()
                )
                ->replace(
                    '$config_directories = array();',
                    '$config_directories[CONFIG_SYNC_DIRECTORY] = dirname(DRUPAL_ROOT) . \'/config\';'
                )
                ->replace(
                    '$settings[\'hash_salt\'] = \'\';',
                    '$settings[\'hash_salt\'] = file_get_contents(dirname(DRUPAL_ROOT) . \'/salt.txt\');'
                )
                ->run();
        }

        return $this;
    }
public function setupDrupalSettings ( ) { $ this -> _copy ( "{$this->sitesPath}/default/default.settings.php" , $ this -> settingFile ) ; $ install_root = dirname ( $ this -> getQualifiedInstallRoot ( ) ) ; if ( $ this -> getProjectVersion ( ) >= 8 ) { $ this -> taskWriteToFile ( "{$install_root}/salt.txt" ) -> line ( Utility :: randomHash ( ) ) -> run ( ) ; $ this -> taskFilesystemStack ( ) -> mkdir ( "{$install_root}/config" , 0775 ) -> chmod ( "{$install_root}/salt.txt" , 0775 ) -> run ( ) ; $ this -> taskWriteToFile ( $ this -> settingFile ) -> append ( ) -> regexReplace ( '/\#\sif.+\/settings\.local\.php.+\n#.+\n\#\s}/' , $ this -> drupalSettingsLocalInclude ( ) ) -> replace ( '$config_directories = array();' , '$config_directories[CONFIG_SYNC_DIRECTORY] = dirname(DRUPAL_ROOT) . \'/config\';' ) -> replace ( '$settings[\'hash_salt\'] = \'\';' , '$settings[\'hash_salt\'] = file_get_contents(dirname(DRUPAL_ROOT) . \'/salt.txt\');' ) -> run ( ) ; } return $ this ; }
Setup Drupal settings file.

The setup process consist of the following:
- Copy over default settings.php.
- Create the Drupal config directory.
- Generate salt and place text file outside docroot.
- Replace commented local.settings include statement.
- Replace $config_directories with a config directory outside docroot.
- Replace $settings['hash_salt'] with path to generated the salt text file.

@return self
Setup Drupal settings file .