source/Setup/Utilities.php
public function updateConfigFile($parameters)
    {
        $configFile = '';
        $language = $this->getInstance("Language");

        if (isset($parameters['sShopDir'])) {
            $configFile = $parameters['sShopDir'] . "/config.inc.php";
        }
        $this->handleMissingConfigFileException($configFile);

        clearstatcache();
        // Make config file writable, as it may be write protected
        @chmod($configFile, getDefaultFileMode());
        if (!$configFileContent = file_get_contents($configFile)) {
            throw new Exception(sprintf($language->getText('ERROR_COULD_NOT_OPEN_CONFIG_FILE'), $configFile));
        }

        // overwriting settings
        foreach ($parameters as $configOption => $value) {
            $search = ["\'", "'" ];
            $replace = ["\\\'", "\'"];
            $escapedValue = str_replace($search, $replace, $value);
            $configFileContent = str_replace("<{$configOption}>", $escapedValue, $configFileContent);
        }

        if (!file_put_contents($configFile, $configFileContent)) {
            throw new Exception(sprintf($language->getText('ERROR_CONFIG_FILE_IS_NOT_WRITABLE'), $configFile));
        }
        // Make config file read-only, this is our recomnedation for config.inc.php
        @chmod($configFile, getDefaultConfigFileMode());
    }
public function updateConfigFile($parameters)
    {
        $configFile = '';
        $language = $this->getInstance("Language");

        if (isset($parameters['sShopDir'])) {
            $configFile = $parameters['sShopDir'] . "/config.inc.php";
        }
        $this->handleMissingConfigFileException($configFile);

        clearstatcache();
        // Make config file writable, as it may be write protected
        @chmod($configFile, getDefaultFileMode());
        if (!$configFileContent = file_get_contents($configFile)) {
            throw new Exception(sprintf($language->getText('ERROR_COULD_NOT_OPEN_CONFIG_FILE'), $configFile));
        }

        // overwriting settings
        foreach ($parameters as $configOption => $value) {
            $search = ["\'", "'" ];
            $replace = ["\\\'", "\'"];
            $escapedValue = str_replace($search, $replace, $value);
            $configFileContent = str_replace("<{$configOption}>", $escapedValue, $configFileContent);
        }

        if (!file_put_contents($configFile, $configFileContent)) {
            throw new Exception(sprintf($language->getText('ERROR_CONFIG_FILE_IS_NOT_WRITABLE'), $configFile));
        }
        // Make config file read-only, this is our recomnedation for config.inc.php
        @chmod($configFile, getDefaultConfigFileMode());
    }
public function updateConfigFile ( $ parameters ) { $ configFile = '' ; $ language = $ this -> getInstance ( "Language" ) ; if ( isset ( $ parameters [ 'sShopDir' ] ) ) { $ configFile = $ parameters [ 'sShopDir' ] . "/config.inc.php" ; } $ this -> handleMissingConfigFileException ( $ configFile ) ; clearstatcache ( ) ; // Make config file writable, as it may be write protected @ chmod ( $ configFile , getDefaultFileMode ( ) ) ; if ( ! $ configFileContent = file_get_contents ( $ configFile ) ) { throw new Exception ( sprintf ( $ language -> getText ( 'ERROR_COULD_NOT_OPEN_CONFIG_FILE' ) , $ configFile ) ) ; } // overwriting settings foreach ( $ parameters as $ configOption => $ value ) { $ search = [ "\'" , "'" ] ; $ replace = [ "\\\'" , "\'" ] ; $ escapedValue = str_replace ( $ search , $ replace , $ value ) ; $ configFileContent = str_replace ( "<{$configOption}>" , $ escapedValue , $ configFileContent ) ; } if ( ! file_put_contents ( $ configFile , $ configFileContent ) ) { throw new Exception ( sprintf ( $ language -> getText ( 'ERROR_CONFIG_FILE_IS_NOT_WRITABLE' ) , $ configFile ) ) ; } // Make config file read-only, this is our recomnedation for config.inc.php @ chmod ( $ configFile , getDefaultConfigFileMode ( ) ) ; }
Updates config.inc.php file contents.

@param array $parameters Configuration parameters as submitted by the user

@throws Exception File can't be found, opened for reading or written.
Updates config . inc . php file contents .