protected function lowlevelConfigFix($name)
    {
        $distname = realpath(__DIR__ . '/../../app/config/' . $name . '.yml.dist');
        $ymlname = $this->config->getPath('config') . '/' . $name . '.yml';

        if (file_exists($ymlname) && !is_readable($ymlname)) {
            $error = sprintf(
                "Couldn't read <code>%s</code>-file inside <code>%s</code>. Make sure the file exists and is readable to the user that the web server is using.",
                htmlspecialchars($name . '.yml', ENT_QUOTES),
                htmlspecialchars($this->config->getPath('config'), ENT_QUOTES)
            );
            throw new BootException($error);
        }

        if (!file_exists($ymlname)) {
            // Try and copy from the .dist config file
            try {
                copy($distname, $ymlname);
            } catch (\Exception $e) {
                $message = sprintf(
                    "Couldn't create a new <code>%s</code>-file inside <code>%s</code>. Create the file manually by copying
                    <code>%s</code>, and optionally make it writable to the user that the web server is using.",
                    htmlspecialchars($name . '.yml', ENT_QUOTES),
                    htmlspecialchars($this->config->getPath('config'), ENT_QUOTES),
                    htmlspecialchars($name . '.yml.dist', ENT_QUOTES)
                );

                throw new BootException($message);
            }
        }
    }
protected function lowlevelConfigFix($name)
    {
        $distname = realpath(__DIR__ . '/../../app/config/' . $name . '.yml.dist');
        $ymlname = $this->config->getPath('config') . '/' . $name . '.yml';

        if (file_exists($ymlname) && !is_readable($ymlname)) {
            $error = sprintf(
                "Couldn't read <code>%s</code>-file inside <code>%s</code>. Make sure the file exists and is readable to the user that the web server is using.",
                htmlspecialchars($name . '.yml', ENT_QUOTES),
                htmlspecialchars($this->config->getPath('config'), ENT_QUOTES)
            );
            throw new BootException($error);
        }

        if (!file_exists($ymlname)) {
            // Try and copy from the .dist config file
            try {
                copy($distname, $ymlname);
            } catch (\Exception $e) {
                $message = sprintf(
                    "Couldn't create a new <code>%s</code>-file inside <code>%s</code>. Create the file manually by copying
                    <code>%s</code>, and optionally make it writable to the user that the web server is using.",
                    htmlspecialchars($name . '.yml', ENT_QUOTES),
                    htmlspecialchars($this->config->getPath('config'), ENT_QUOTES),
                    htmlspecialchars($name . '.yml.dist', ENT_QUOTES)
                );

                throw new BootException($message);
            }
        }
    }
protected function lowlevelConfigFix ( $ name ) { $ distname = realpath ( __DIR__ . '/../../app/config/' . $ name . '.yml.dist' ) ; $ ymlname = $ this -> config -> getPath ( 'config' ) . '/' . $ name . '.yml' ; if ( file_exists ( $ ymlname ) && ! is_readable ( $ ymlname ) ) { $ error = sprintf ( "Couldn't read <code>%s</code>-file inside <code>%s</code>. Make sure the file exists and is readable to the user that the web server is using." , htmlspecialchars ( $ name . '.yml' , ENT_QUOTES ) , htmlspecialchars ( $ this -> config -> getPath ( 'config' ) , ENT_QUOTES ) ) ; throw new BootException ( $ error ) ; } if ( ! file_exists ( $ ymlname ) ) { // Try and copy from the .dist config file try { copy ( $ distname , $ ymlname ) ; } catch ( \ Exception $ e ) { $ message = sprintf ( "Couldn't create a new <code>%s</code>-file inside <code>%s</code>. Create the file manually by copying
                    <code>%s</code>, and optionally make it writable to the user that the web server is using." , htmlspecialchars ( $ name . '.yml' , ENT_QUOTES ) , htmlspecialchars ( $ this -> config -> getPath ( 'config' ) , ENT_QUOTES ) , htmlspecialchars ( $ name . '.yml.dist' , ENT_QUOTES ) ) ; throw new BootException ( $ message ) ; } } }
Check if a config file is present and writable. If not, try to create it
from the filename.dist.

@param string $name Filename stem; .yml extension will be added automatically.

@throws \Bolt\Exception\BootException
Check if a config file is present and writable . If not try to create it from the filename . dist .