protected function copyExistingInstall()
    {
        if (!$this->fs->exists($this->appRoot . '/sites/default/settings.php')) {
            $this->getIo()->error(
                sprintf(
                    $this->trans('commands.multisite.new.errors.file-missing'),
                    'sites/default/settings.php'
                )
            );
            return 1;
        }

        if ($this->fs->exists($this->appRoot . '/sites/default/files')) {
            try {
                $this->fs->mirror(
                    $this->appRoot . '/sites/default/files',
                    $this->appRoot . '/sites/' . $this->directory . '/files'
                );
            } catch (IOExceptionInterface $e) {
                $this->getIo()->error(
                    sprintf(
                        $this->trans('commands.multisite.new.errors.copy-fail'),
                        'sites/default/files',
                        'sites/' . $this->directory . '/files'
                    )
                );
                return 1;
            }
        } else {
            $this->getIo()->warning($this->trans('commands.multisite.new.warnings.missing-files'));
        }

        $settings = file_get_contents($this->appRoot . '/sites/default/settings.php');
        $settings = str_replace('sites/default', 'sites/' . $this->directory, $settings);

        try {
            $this->fs->dumpFile(
                $this->appRoot . '/sites/' . $this->directory . '/settings.php',
                $settings
            );
        } catch (IOExceptionInterface $e) {
            $this->getIo()->error(
                sprintf(
                    $this->trans('commands.multisite.new.errors.write-fail'),
                    'sites/' . $this->directory . '/settings.php'
                )
            );
            return 1;
        }

        $this->chmodSettings();

        $this->getIo()->success(
            sprintf(
                $this->trans('commands.multisite.new.messages.copy-default'),
                $this->directory
            )
        );
    }
protected function copyExistingInstall()
    {
        if (!$this->fs->exists($this->appRoot . '/sites/default/settings.php')) {
            $this->getIo()->error(
                sprintf(
                    $this->trans('commands.multisite.new.errors.file-missing'),
                    'sites/default/settings.php'
                )
            );
            return 1;
        }

        if ($this->fs->exists($this->appRoot . '/sites/default/files')) {
            try {
                $this->fs->mirror(
                    $this->appRoot . '/sites/default/files',
                    $this->appRoot . '/sites/' . $this->directory . '/files'
                );
            } catch (IOExceptionInterface $e) {
                $this->getIo()->error(
                    sprintf(
                        $this->trans('commands.multisite.new.errors.copy-fail'),
                        'sites/default/files',
                        'sites/' . $this->directory . '/files'
                    )
                );
                return 1;
            }
        } else {
            $this->getIo()->warning($this->trans('commands.multisite.new.warnings.missing-files'));
        }

        $settings = file_get_contents($this->appRoot . '/sites/default/settings.php');
        $settings = str_replace('sites/default', 'sites/' . $this->directory, $settings);

        try {
            $this->fs->dumpFile(
                $this->appRoot . '/sites/' . $this->directory . '/settings.php',
                $settings
            );
        } catch (IOExceptionInterface $e) {
            $this->getIo()->error(
                sprintf(
                    $this->trans('commands.multisite.new.errors.write-fail'),
                    'sites/' . $this->directory . '/settings.php'
                )
            );
            return 1;
        }

        $this->chmodSettings();

        $this->getIo()->success(
            sprintf(
                $this->trans('commands.multisite.new.messages.copy-default'),
                $this->directory
            )
        );
    }
protected function copyExistingInstall ( ) { if ( ! $ this -> fs -> exists ( $ this -> appRoot . '/sites/default/settings.php' ) ) { $ this -> getIo ( ) -> error ( sprintf ( $ this -> trans ( 'commands.multisite.new.errors.file-missing' ) , 'sites/default/settings.php' ) ) ; return 1 ; } if ( $ this -> fs -> exists ( $ this -> appRoot . '/sites/default/files' ) ) { try { $ this -> fs -> mirror ( $ this -> appRoot . '/sites/default/files' , $ this -> appRoot . '/sites/' . $ this -> directory . '/files' ) ; } catch ( IOExceptionInterface $ e ) { $ this -> getIo ( ) -> error ( sprintf ( $ this -> trans ( 'commands.multisite.new.errors.copy-fail' ) , 'sites/default/files' , 'sites/' . $ this -> directory . '/files' ) ) ; return 1 ; } } else { $ this -> getIo ( ) -> warning ( $ this -> trans ( 'commands.multisite.new.warnings.missing-files' ) ) ; } $ settings = file_get_contents ( $ this -> appRoot . '/sites/default/settings.php' ) ; $ settings = str_replace ( 'sites/default' , 'sites/' . $ this -> directory , $ settings ) ; try { $ this -> fs -> dumpFile ( $ this -> appRoot . '/sites/' . $ this -> directory . '/settings.php' , $ settings ) ; } catch ( IOExceptionInterface $ e ) { $ this -> getIo ( ) -> error ( sprintf ( $ this -> trans ( 'commands.multisite.new.errors.write-fail' ) , 'sites/' . $ this -> directory . '/settings.php' ) ) ; return 1 ; } $ this -> chmodSettings ( ) ; $ this -> getIo ( ) -> success ( sprintf ( $ this -> trans ( 'commands.multisite.new.messages.copy-default' ) , $ this -> directory ) ) ; }
Copies detected default install alters settings.php to fit the new directory.
Copies detected default install alters settings . php to fit the new directory .