protected function ensureSettings() {
        if (!$this->fs->exists(Platform::webDir() . '/sites/default')) {
            $this->fs->mkdir(Platform::webDir() . '/sites/default', 0775);
        }
        else {
            // If building from an existing project, Drupal may have fiddled with
            // the permissions preventing us from writing.
            $this->fs->chmod(Platform::webDir() . '/sites/default', 0775);
        }
        $has_settings = $this->fs->exists(Platform::webDir() . '/sites/default/settings.php');
        if ($has_settings) {
            $this->fs->chmod(Platform::webDir() . '/sites/default/settings.php', 0664);
        }

        switch ($this->version) {
            case DrupalStackHelper::DRUPAL7:
                if (!$has_settings) {
                    $this->fs->copy(CLI_ROOT . '/resources/stacks/drupal7/settings.php', Platform::webDir() . '/sites/default/settings.php', true);
                }
                break;
            case DrupalStackHelper::DRUPAL8:
                if (!$has_settings) {
                    $this->fs->copy(CLI_ROOT . '/resources/stacks/drupal8/settings.php', Platform::webDir() . '/sites/default/settings.php', true);
                }
                $this->fs->mkdir([
                  Platform::sharedDir() . '/config',
                  Platform::sharedDir() . '/config/active',
                  Platform::sharedDir() . '/config/staging',
                ]);
                break;
            default:
                throw new \Exception('Unsupported version of Drupal. Write a pull reuqest!');
        }
    }
protected function ensureSettings() {
        if (!$this->fs->exists(Platform::webDir() . '/sites/default')) {
            $this->fs->mkdir(Platform::webDir() . '/sites/default', 0775);
        }
        else {
            // If building from an existing project, Drupal may have fiddled with
            // the permissions preventing us from writing.
            $this->fs->chmod(Platform::webDir() . '/sites/default', 0775);
        }
        $has_settings = $this->fs->exists(Platform::webDir() . '/sites/default/settings.php');
        if ($has_settings) {
            $this->fs->chmod(Platform::webDir() . '/sites/default/settings.php', 0664);
        }

        switch ($this->version) {
            case DrupalStackHelper::DRUPAL7:
                if (!$has_settings) {
                    $this->fs->copy(CLI_ROOT . '/resources/stacks/drupal7/settings.php', Platform::webDir() . '/sites/default/settings.php', true);
                }
                break;
            case DrupalStackHelper::DRUPAL8:
                if (!$has_settings) {
                    $this->fs->copy(CLI_ROOT . '/resources/stacks/drupal8/settings.php', Platform::webDir() . '/sites/default/settings.php', true);
                }
                $this->fs->mkdir([
                  Platform::sharedDir() . '/config',
                  Platform::sharedDir() . '/config/active',
                  Platform::sharedDir() . '/config/staging',
                ]);
                break;
            default:
                throw new \Exception('Unsupported version of Drupal. Write a pull reuqest!');
        }
    }
protected function ensureSettings ( ) { if ( ! $ this -> fs -> exists ( Platform :: webDir ( ) . '/sites/default' ) ) { $ this -> fs -> mkdir ( Platform :: webDir ( ) . '/sites/default' , 0775 ) ; } else { // If building from an existing project, Drupal may have fiddled with // the permissions preventing us from writing. $ this -> fs -> chmod ( Platform :: webDir ( ) . '/sites/default' , 0775 ) ; } $ has_settings = $ this -> fs -> exists ( Platform :: webDir ( ) . '/sites/default/settings.php' ) ; if ( $ has_settings ) { $ this -> fs -> chmod ( Platform :: webDir ( ) . '/sites/default/settings.php' , 0664 ) ; } switch ( $ this -> version ) { case DrupalStackHelper :: DRUPAL7 : if ( ! $ has_settings ) { $ this -> fs -> copy ( CLI_ROOT . '/resources/stacks/drupal7/settings.php' , Platform :: webDir ( ) . '/sites/default/settings.php' , true ) ; } break ; case DrupalStackHelper :: DRUPAL8 : if ( ! $ has_settings ) { $ this -> fs -> copy ( CLI_ROOT . '/resources/stacks/drupal8/settings.php' , Platform :: webDir ( ) . '/sites/default/settings.php' , true ) ; } $ this -> fs -> mkdir ( [ Platform :: sharedDir ( ) . '/config' , Platform :: sharedDir ( ) . '/config/active' , Platform :: sharedDir ( ) . '/config/staging' , ] ) ; break ; default : throw new \ Exception ( 'Unsupported version of Drupal. Write a pull reuqest!' ) ; } }
Ensures that the Drupal settings.php is available.
@throws \Exception
Ensures that the Drupal settings . php is available .