protected function addToSitesFile($uri)
    {
        if ($this->fs->exists($this->appRoot . '/sites/sites.php')) {
            $sites_is_dir = is_dir($this->appRoot . '/sites/sites.php');
            $sites_readable = is_readable($this->appRoot . '/sites/sites.php');
            if ($sites_is_dir || !$sites_readable) {
                throw new FileNotFoundException($this->trans('commands.multisite.new.errors.sites-invalid'));
            }
            $sites_file_contents = file_get_contents($this->appRoot . '/sites/sites.php');
        } elseif ($this->fs->exists($this->appRoot . '/sites/example.sites.php')) {
            $sites_file_contents = file_get_contents($this->appRoot . '/sites/example.sites.php');
            $sites_file_contents .= "\n\$sites = [];";
        } else {
            throw new FileNotFoundException($this->trans('commands.multisite.new.errors.sites-missing'));
        }

        $sites_file_contents .= "\n\$sites['$this->directory'] = '$this->directory';";

        try {
            $this->fs->dumpFile($this->appRoot . '/sites/sites.php', $sites_file_contents);
            $this->fs->chmod($this->appRoot . '/sites/sites.php', 0640);
        } catch (IOExceptionInterface $e) {
            $this->getIo()->error('commands.multisite.new.errors.sites-other');
        }
    }
protected function addToSitesFile($uri)
    {
        if ($this->fs->exists($this->appRoot . '/sites/sites.php')) {
            $sites_is_dir = is_dir($this->appRoot . '/sites/sites.php');
            $sites_readable = is_readable($this->appRoot . '/sites/sites.php');
            if ($sites_is_dir || !$sites_readable) {
                throw new FileNotFoundException($this->trans('commands.multisite.new.errors.sites-invalid'));
            }
            $sites_file_contents = file_get_contents($this->appRoot . '/sites/sites.php');
        } elseif ($this->fs->exists($this->appRoot . '/sites/example.sites.php')) {
            $sites_file_contents = file_get_contents($this->appRoot . '/sites/example.sites.php');
            $sites_file_contents .= "\n\$sites = [];";
        } else {
            throw new FileNotFoundException($this->trans('commands.multisite.new.errors.sites-missing'));
        }

        $sites_file_contents .= "\n\$sites['$this->directory'] = '$this->directory';";

        try {
            $this->fs->dumpFile($this->appRoot . '/sites/sites.php', $sites_file_contents);
            $this->fs->chmod($this->appRoot . '/sites/sites.php', 0640);
        } catch (IOExceptionInterface $e) {
            $this->getIo()->error('commands.multisite.new.errors.sites-other');
        }
    }
protected function addToSitesFile ( $ uri ) { if ( $ this -> fs -> exists ( $ this -> appRoot . '/sites/sites.php' ) ) { $ sites_is_dir = is_dir ( $ this -> appRoot . '/sites/sites.php' ) ; $ sites_readable = is_readable ( $ this -> appRoot . '/sites/sites.php' ) ; if ( $ sites_is_dir || ! $ sites_readable ) { throw new FileNotFoundException ( $ this -> trans ( 'commands.multisite.new.errors.sites-invalid' ) ) ; } $ sites_file_contents = file_get_contents ( $ this -> appRoot . '/sites/sites.php' ) ; } elseif ( $ this -> fs -> exists ( $ this -> appRoot . '/sites/example.sites.php' ) ) { $ sites_file_contents = file_get_contents ( $ this -> appRoot . '/sites/example.sites.php' ) ; $ sites_file_contents .= "\n\$sites = [];" ; } else { throw new FileNotFoundException ( $ this -> trans ( 'commands.multisite.new.errors.sites-missing' ) ) ; } $ sites_file_contents .= "\n\$sites['$this->directory'] = '$this->directory';" ; try { $ this -> fs -> dumpFile ( $ this -> appRoot . '/sites/sites.php' , $ sites_file_contents ) ; $ this -> fs -> chmod ( $ this -> appRoot . '/sites/sites.php' , 0640 ) ; } catch ( IOExceptionInterface $ e ) { $ this -> getIo ( ) -> error ( 'commands.multisite.new.errors.sites-other' ) ; } }
Adds line to sites.php that is needed for the new site to be recognized.

@param string      $uri

@throws FileNotFoundException
Adds line to sites . php that is needed for the new site to be recognized .