protected function configureServer($forceOverwrite = false)
    {
        // Get server type
        $type = isset($_SERVER['SERVER_SOFTWARE']) ? $_SERVER['SERVER_SOFTWARE'] : '*';
        list($type) = explode('/', strtolower($type));

        // Determine configurations to write
        $rules = $this->config()->get('server_configuration');
        if (empty($rules[$type])) {
            $type = $this->config()->get('default_server');
            if (!$type || empty($rules[$type])) {
                return;
            }
        }
        $configurations = $rules[$type];

        $visibility = 'public';

        // Apply each configuration
        $config = new FlysystemConfig();
        $config->set('visibility', $visibility);
        foreach ($configurations as $file => $template) {
            // Ensure file contents
            if ($forceOverwrite || !$this->has($file)) {
                // Evaluate file
                $content = $this->renderTemplate($template);
                $success = $this->write($file, $content, $config);
                if (!$success) {
                    throw new Exception("Error writing server configuration file \"{$file}\"");
                }
            }
            $perms = $this->getVisibility($file);
            if ($perms['visibility'] !== $visibility) {
                // Ensure correct permissions
                $this->setVisibility($file, $visibility);
            }
        }
    }
protected function configureServer($forceOverwrite = false)
    {
        // Get server type
        $type = isset($_SERVER['SERVER_SOFTWARE']) ? $_SERVER['SERVER_SOFTWARE'] : '*';
        list($type) = explode('/', strtolower($type));

        // Determine configurations to write
        $rules = $this->config()->get('server_configuration');
        if (empty($rules[$type])) {
            $type = $this->config()->get('default_server');
            if (!$type || empty($rules[$type])) {
                return;
            }
        }
        $configurations = $rules[$type];

        $visibility = 'public';

        // Apply each configuration
        $config = new FlysystemConfig();
        $config->set('visibility', $visibility);
        foreach ($configurations as $file => $template) {
            // Ensure file contents
            if ($forceOverwrite || !$this->has($file)) {
                // Evaluate file
                $content = $this->renderTemplate($template);
                $success = $this->write($file, $content, $config);
                if (!$success) {
                    throw new Exception("Error writing server configuration file \"{$file}\"");
                }
            }
            $perms = $this->getVisibility($file);
            if ($perms['visibility'] !== $visibility) {
                // Ensure correct permissions
                $this->setVisibility($file, $visibility);
            }
        }
    }
protected function configureServer ( $ forceOverwrite = false ) { // Get server type $ type = isset ( $ _SERVER [ 'SERVER_SOFTWARE' ] ) ? $ _SERVER [ 'SERVER_SOFTWARE' ] : '*' ; list ( $ type ) = explode ( '/' , strtolower ( $ type ) ) ; // Determine configurations to write $ rules = $ this -> config ( ) -> get ( 'server_configuration' ) ; if ( empty ( $ rules [ $ type ] ) ) { $ type = $ this -> config ( ) -> get ( 'default_server' ) ; if ( ! $ type || empty ( $ rules [ $ type ] ) ) { return ; } } $ configurations = $ rules [ $ type ] ; $ visibility = 'public' ; // Apply each configuration $ config = new FlysystemConfig ( ) ; $ config -> set ( 'visibility' , $ visibility ) ; foreach ( $ configurations as $ file => $ template ) { // Ensure file contents if ( $ forceOverwrite || ! $ this -> has ( $ file ) ) { // Evaluate file $ content = $ this -> renderTemplate ( $ template ) ; $ success = $ this -> write ( $ file , $ content , $ config ) ; if ( ! $ success ) { throw new Exception ( "Error writing server configuration file \"{$file}\"" ) ; } } $ perms = $ this -> getVisibility ( $ file ) ; if ( $ perms [ 'visibility' ] !== $ visibility ) { // Ensure correct permissions $ this -> setVisibility ( $ file , $ visibility ) ; } } }
Configure server files for this store

@param bool $forceOverwrite Force regeneration even if files already exist
@throws Exception
Configure server files for this store