public function setupDrupalInstall($localhost = false)
    {
        $this->say('Waiting on Drupal database to become available...');

        $database = $this->getDatabaseInfo();

        $engine = $this->getEngineInstance();
        $install_path = $this->getInstallPath();

        if ($engine instanceof DockerEngineType && !$localhost) {
            $drush = $this->drushInstallCommonStack(
                '/var/www/html/vendor/bin/drush',
                '/var/www/html' . static::installRoot(),
                $database
            );
            $result = $engine->execRaw(
                $drush->getCommand(),
                $this->getPhpServiceName()
            );
        } else {
            // Run the drupal installation from the host machine. The host will
            // need to have the database client binaries installed.
            $database->setHostname('127.0.0.1');

            if (!$this->hasDatabaseConnection($database->getHostname(), $database->getPort())) {
                throw new \Exception(
                    sprintf('Unable to connection to Drupal database %s', $database->getHostname())
                );
            }
            // Sometimes it takes awhile after the mysql host is up on the
            // network to become totally available to except connections. Due to
            // the uncertainty we'll need to sleep for about 30 seconds.
            sleep(30);

            $result = $this->drushInstallCommonStack(
                'drush',
                $install_path,
                $database
            )->run();
        }
        $this->validateTaskResult($result);

        // Update permissions to ensure all files can be accessed on the install
        // path for both user and groups.
        $this->_chmod($install_path, 0775, 0000, true);

        return $this;
    }
public function setupDrupalInstall($localhost = false)
    {
        $this->say('Waiting on Drupal database to become available...');

        $database = $this->getDatabaseInfo();

        $engine = $this->getEngineInstance();
        $install_path = $this->getInstallPath();

        if ($engine instanceof DockerEngineType && !$localhost) {
            $drush = $this->drushInstallCommonStack(
                '/var/www/html/vendor/bin/drush',
                '/var/www/html' . static::installRoot(),
                $database
            );
            $result = $engine->execRaw(
                $drush->getCommand(),
                $this->getPhpServiceName()
            );
        } else {
            // Run the drupal installation from the host machine. The host will
            // need to have the database client binaries installed.
            $database->setHostname('127.0.0.1');

            if (!$this->hasDatabaseConnection($database->getHostname(), $database->getPort())) {
                throw new \Exception(
                    sprintf('Unable to connection to Drupal database %s', $database->getHostname())
                );
            }
            // Sometimes it takes awhile after the mysql host is up on the
            // network to become totally available to except connections. Due to
            // the uncertainty we'll need to sleep for about 30 seconds.
            sleep(30);

            $result = $this->drushInstallCommonStack(
                'drush',
                $install_path,
                $database
            )->run();
        }
        $this->validateTaskResult($result);

        // Update permissions to ensure all files can be accessed on the install
        // path for both user and groups.
        $this->_chmod($install_path, 0775, 0000, true);

        return $this;
    }
public function setupDrupalInstall ( $ localhost = false ) { $ this -> say ( 'Waiting on Drupal database to become available...' ) ; $ database = $ this -> getDatabaseInfo ( ) ; $ engine = $ this -> getEngineInstance ( ) ; $ install_path = $ this -> getInstallPath ( ) ; if ( $ engine instanceof DockerEngineType && ! $ localhost ) { $ drush = $ this -> drushInstallCommonStack ( '/var/www/html/vendor/bin/drush' , '/var/www/html' . static :: installRoot ( ) , $ database ) ; $ result = $ engine -> execRaw ( $ drush -> getCommand ( ) , $ this -> getPhpServiceName ( ) ) ; } else { // Run the drupal installation from the host machine. The host will // need to have the database client binaries installed. $ database -> setHostname ( '127.0.0.1' ) ; if ( ! $ this -> hasDatabaseConnection ( $ database -> getHostname ( ) , $ database -> getPort ( ) ) ) { throw new \ Exception ( sprintf ( 'Unable to connection to Drupal database %s' , $ database -> getHostname ( ) ) ) ; } // Sometimes it takes awhile after the mysql host is up on the // network to become totally available to except connections. Due to // the uncertainty we'll need to sleep for about 30 seconds. sleep ( 30 ) ; $ result = $ this -> drushInstallCommonStack ( 'drush' , $ install_path , $ database ) -> run ( ) ; } $ this -> validateTaskResult ( $ result ) ; // Update permissions to ensure all files can be accessed on the install // path for both user and groups. $ this -> _chmod ( $ install_path , 0775 , 0000 , true ) ; return $ this ; }
Setup Drupal install.

The setup process consist of the following:
- Check if project database is available.
- Install Drupal using the drush executable.
- Update install path permissions recursively.

@param bool $localhost
A flag to determine if Drupal should be installed using localhost.

@return self
@throws \Robo\Exception\TaskException
Setup Drupal install .