Bolt\Configuration\PreBoot\ConfigurationFile::checkConfigFile PHP Method

checkConfigFile() public static method

- If file exists, and readable, do nothing. - Attempt to copy .yml.dist file to the working .yml name/location
public static checkConfigFile ( string $configName, string $rootConfigDir, string $siteConfigPath ) : null
$configName string
$rootConfigDir string
$siteConfigPath string
return null
    public static function checkConfigFile($configName, $rootConfigDir, $siteConfigPath)
    {
        $fs = new Filesystem();
        $configFileName = $configName . '.yml';
        $configFileFullPath = $siteConfigPath . '/' . $configFileName;
        $configFileDistName = $configName . '.yml.dist';
        $configFileDistNameFullPath = $rootConfigDir . '/' . $configFileDistName;
        if ($fs->exists($configFileFullPath)) {
            if (is_readable($configFileFullPath)) {
                return null;
            }
            throw new BootException(sprintf('Unable to read configuration file "%s"', $configFileName));
        }
        try {
            $fs->copy($configFileDistNameFullPath, $configFileFullPath, false);
        } catch (IOException $e) {
            throw new BootException(sprintf('Unable to create configuration file "%s"', $configFileName));
        }
        return null;
    }