Skip to content

Commit 36f2ec6

Browse files
Merge pull request #59 from dennisinteractive/CMS-1244-use-drush
CMS-1244 Use drush commands and not drupal console
2 parents e28dfc1 + 96b51a6 commit 36f2ec6

File tree

2 files changed

+15
-26
lines changed

2 files changed

+15
-26
lines changed

src/Command/Site/DbImportCommand.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,8 @@ protected function execute(InputInterface $input, OutputInterface $output) {
209209
// this was a quick fix.
210210
if ($this->getDrupalVersion() === 8) {
211211
$config_commands[] = sprintf('cd %s', $this->shellPath($this->getWebRoot()));
212-
$config_commands[] = 'drupal config:import';
213-
$config_commands[] = 'drupal cache:rebuild';
212+
$config_commands[] = 'drush cim -y';
213+
$config_commands[] = 'drush cr';
214214
$config_command = implode(' && ', $config_commands);
215215

216216
$this->io->commentBlock($config_command);
@@ -297,9 +297,13 @@ protected function getSqlImportCommands() {
297297
// Drupal 8 only;
298298
if ($this->getDrupalVersion() === 8) {
299299
$commands[] = sprintf('cd %s', $this->shellPath($this->getWebRoot()));
300-
$commands[] = sprintf('drupal database:restore --file=%s', $this->filename);
301-
$commands[] = 'drupal cache:rebuild all';
302-
$commands[] = sprintf('drupal user:password:reset 1 %s', $this->config['account-pass']);
300+
$commands[] = sprintf('drush sql-create -y');
301+
$commands[] = sprintf('drush sql-cli < %s', $this->filename);
302+
$commands[] = 'drush cr';
303+
$commands[] = sprintf('drush user-password %s "%s"',
304+
$this->config['account-name'],
305+
$this->config['account-pass']
306+
);
303307
}
304308

305309
return $commands;

src/Command/Site/UpdateCommand.php

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,10 @@ protected function execute(InputInterface $input, OutputInterface $output) {
6464

6565
// Drupal 8 only;
6666
if ($this->getDrupalVersion() === 8) {
67-
$commands[] = 'drupal update:execute';
67+
$commands[] = 'drush cim -y';
68+
$commands[] = 'drush cr';
69+
$commands[] = 'drush updb -y';
70+
$commands[] = 'drush cr';
6871
$this->addModuleEnableCommands($commands);
6972
$this->addModuleDisableCommands($commands);
7073

@@ -85,24 +88,6 @@ protected function execute(InputInterface $input, OutputInterface $output) {
8588
throw new CommandException($shellProcess->getOutput());
8689
}
8790

88-
// We run config:import separately so that if there's no config and it
89-
// fails we can continue. Previously, we checked the config folder, but this
90-
// was a quick fix.
91-
if ($this->getDrupalVersion() === 8) {
92-
$config_commands[] = sprintf('cd %s', $this->shellPath($this->getWebRoot()));
93-
$config_commands[] = 'drupal config:import';
94-
$config_commands[] = 'drupal cache:rebuild';
95-
$config_command = implode(' && ', $config_commands);
96-
97-
$this->io->commentBlock($config_command);
98-
99-
try {
100-
$shellProcess->exec($config_command, TRUE);
101-
}
102-
catch (ProcessFailedException $e) {
103-
}
104-
}
105-
10691
}
10792

10893
/**
@@ -118,7 +103,7 @@ private function addModuleEnableCommands(&$commands) {
118103

119104
// Drupal 8 only;
120105
if ($this->getDrupalVersion() === 8) {
121-
$commands[] = sprintf('drupal module:install %s', implode(', ', $this->config['modules']['enable']));
106+
$commands[] = sprintf('drush en -y %s', implode(', ', $this->config['modules']['enable']));
122107
}
123108
}
124109
}
@@ -137,7 +122,7 @@ private function addModuleDisableCommands(&$commands) {
137122

138123
// Drupal 8 only;
139124
if ($this->getDrupalVersion() === 8) {
140-
$commands[] = sprintf('drupal module:uninstall %s', implode(', ', $this->config['modules']['disable']));
125+
$commands[] = sprintf('drush pm-uninstall -y %s', implode(', ', $this->config['modules']['disable']));
141126
}
142127
}
143128
}

0 commit comments

Comments
 (0)