public function drupalRefresh($opts = [
        'db-name' => null,
        'db-user' => null,
        'db-pass' => null,
        'db-host' => null,
        'db-port' => null,
        'db-protocol' => null,
        'hard' => false,
        'localhost' => false,
    ])
    {
        $this->executeCommandHook(__FUNCTION__, 'before');
        $localhost = $opts['localhost'];

        /** @var DrupalProjectType $instance */
        $instance = $this->getProjectInstance();
        $version = $instance->getProjectVersion();

        // Composer install.
        $this->taskComposerInstall()->run();

        if ($opts['hard']) {
            $database = $this->buildDatabase($opts);
            // Reinstall the Drupal database, which drops the existing data.
            $instance
                ->setDatabaseOverride($database)
                ->setupDrupalInstall(
                    $localhost
                );

            if ($version >= 8) {
                $instance->setDrupalUuid($localhost);
            }
        }
        $drush = new DrushCommand(null, $localhost);

        if ($version >= 8) {
            $instance->runDrushCommand('updb --entity-updates', false, $localhost);
            $instance->importDrupalConfig(1, $localhost);
            $drush->command('cr');
        } else {
            $drush
                ->command('updb')
                ->command('cc all');
        }
        $instance->runDrushCommand($drush, false, $localhost);

        $this->executeCommandHook(__FUNCTION__, 'after');

        return $this;
    }
public function drupalRefresh($opts = [
        'db-name' => null,
        'db-user' => null,
        'db-pass' => null,
        'db-host' => null,
        'db-port' => null,
        'db-protocol' => null,
        'hard' => false,
        'localhost' => false,
    ])
    {
        $this->executeCommandHook(__FUNCTION__, 'before');
        $localhost = $opts['localhost'];

        /** @var DrupalProjectType $instance */
        $instance = $this->getProjectInstance();
        $version = $instance->getProjectVersion();

        // Composer install.
        $this->taskComposerInstall()->run();

        if ($opts['hard']) {
            $database = $this->buildDatabase($opts);
            // Reinstall the Drupal database, which drops the existing data.
            $instance
                ->setDatabaseOverride($database)
                ->setupDrupalInstall(
                    $localhost
                );

            if ($version >= 8) {
                $instance->setDrupalUuid($localhost);
            }
        }
        $drush = new DrushCommand(null, $localhost);

        if ($version >= 8) {
            $instance->runDrushCommand('updb --entity-updates', false, $localhost);
            $instance->importDrupalConfig(1, $localhost);
            $drush->command('cr');
        } else {
            $drush
                ->command('updb')
                ->command('cc all');
        }
        $instance->runDrushCommand($drush, false, $localhost);

        $this->executeCommandHook(__FUNCTION__, 'after');

        return $this;
    }
public function drupalRefresh ( $ opts = [ 'db-name' => null , 'db-user' => null , 'db-pass' => null , 'db-host' => null , 'db-port' => null , 'db-protocol' => null , 'hard' => false , 'localhost' => false , ] ) { $ this -> executeCommandHook ( __FUNCTION__ , 'before' ) ; $ localhost = $ opts [ 'localhost' ] ; /** @var DrupalProjectType $instance */ $ instance = $ this -> getProjectInstance ( ) ; $ version = $ instance -> getProjectVersion ( ) ; // Composer install. $ this -> taskComposerInstall ( ) -> run ( ) ; if ( $ opts [ 'hard' ] ) { $ database = $ this -> buildDatabase ( $ opts ) ; // Reinstall the Drupal database, which drops the existing data. $ instance -> setDatabaseOverride ( $ database ) -> setupDrupalInstall ( $ localhost ) ; if ( $ version >= 8 ) { $ instance -> setDrupalUuid ( $ localhost ) ; } } $ drush = new DrushCommand ( null , $ localhost ) ; if ( $ version >= 8 ) { $ instance -> runDrushCommand ( 'updb --entity-updates' , false , $ localhost ) ; $ instance -> importDrupalConfig ( 1 , $ localhost ) ; $ drush -> command ( 'cr' ) ; } else { $ drush -> command ( 'updb' ) -> command ( 'cc all' ) ; } $ instance -> runDrushCommand ( $ drush , false , $ localhost ) ; $ this -> executeCommandHook ( __FUNCTION__ , 'after' ) ; return $ this ; }
Refresh the local Drupal instance.

@param array $opts

@option string $db-name Set the database name.
@option string $db-user Set the database user.
@option string $db-pass Set the database password.
@option string $db-host Set the database host.
@option string $db-port Set the database port.
@option string $db-protocol Set the database protocol.
@option bool $hard Refresh the site by destroying the database and rebuilding.
@option bool $localhost Reinstall database using localhost.

@return self
@throws \Exception
@throws \Psr\Container\ContainerExceptionInterface
@throws \Psr\Container\NotFoundExceptionInterface
Refresh the local Drupal instance .