Skip to content

Commit

Permalink
Upgrade path fixes. (#2499)
Browse files Browse the repository at this point in the history
  • Loading branch information
grasmash authored Jan 26, 2018
1 parent 9c50f2d commit be40fef
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/Robo/Commands/Setup/ConfigCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class ConfigCommand extends BltTasks {
* Update current database to reflect the state of the Drupal file system.
*
* @command drupal:update
* @aliases setup:update du
* @aliases du setup:update
*/
public function update() {
$this->invokeCommands(['drupal:config:import', 'drupal:toggle:modules']);
Expand Down
8 changes: 4 additions & 4 deletions src/Robo/Commands/Sync/SyncCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ public function allSites() {
* Copies remote db to local db, re-imports config, and executes db updates
* for each multisite.
*
* @command drupal:sync
* @command drupal:sync:default:site
*
* @aliases ds sync
* @aliases ds drupal:sync:default sync sync:refresh
*/
public function sync($options = [
'sync-files' => FALSE,
Expand Down Expand Up @@ -121,9 +121,9 @@ public function syncDbAllSites() {
/**
* Copies remote db to local db for default site.
*
* @command drupal:sync:db
* @command drupal:sync:default:db
*
* @aliases dsb sync:db
* @aliases dsb drupal:sync:db sync:db
*
* @validateDrushConfig
* @executeInDrupalVm
Expand Down
5 changes: 4 additions & 1 deletion src/Robo/Hooks/InteractHook.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,10 @@ public function interactExecuteUpdates(
OutputInterface $output,
AnnotationData $annotationData
) {
if ($this->invokeDepth == 0 && $input->getFirstArgument() != 'blt:update' && !$this->getInspector()->isSchemaVersionUpToDate()) {
if ($this->invokeDepth == 0
&& $input->getFirstArgument() != 'blt:update'
&& $input->getFirstArgument() != 'update'
&& !$this->getInspector()->isSchemaVersionUpToDate()) {
$this->logger->warning("Your BLT schema is out of date.");
if (!$input->isInteractive()) {
$this->logger->warning("Run `blt blt:update` to update it.");
Expand Down
12 changes: 10 additions & 2 deletions src/Update/Updates.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Acquia\Blt\Annotations\Update;
use Acquia\Blt\Robo\Common\ArrayManipulator;
use Dflydev\DotAccessData\Data;
use Symfony\Component\Finder\Finder;
use Symfony\Component\Process\Process;

/**
Expand Down Expand Up @@ -460,7 +461,7 @@ public function update_9000000() {
$this->updater->moveFile('drush/site-aliases/aliases.drushrc.php', 'drush/site-aliases/legacy.aliases.drushrc.php');
$this->updater->replaceInFile('drush/site-aliases/legacy.aliases.drushrc.php', "' . drush_server_home() . '", '$HOME');
$process = new Process(
'./vendor/bin/drush site:alias-convert $(pwd)/drush/sites --sources=$(pwd)/drush/site-aliases',
"./vendor/bin/drush site:alias-convert {$this->updater->getRepoRoot()}/drush/sites --sources={$this->updater->getRepoRoot()}/drush/site-aliases",
$this->updater->getRepoRoot()
);
$process->run();
Expand All @@ -470,7 +471,9 @@ public function update_9000000() {
'legacy.aliases.drushrc.php',
'drush/drushrc.php',
'drush/site-aliases/legacy.aliases.drushrc.php',
'drush/.checksums'
'drush/.checksums',
'example.acsf.aliases.yml',
'example.local.aliases.yml',
];
foreach ($files as $key => $file) {
if (!file_exists($file)) {
Expand All @@ -482,6 +485,10 @@ public function update_9000000() {
$this->updater->getFileSystem()->mirror('drush/site-aliases', 'drush/sites');
$this->updater->getFileSystem()->remove('drush/site-aliases');

$finder = new Finder();
$finder->files()->in(['drush/sites'])->name('*.md5');
$this->updater->getFileSystem()->remove([iterator_to_array($finder->getIterator())]);

$this->updater->moveFile('blt/example.project.local.yml', 'blt/example.local.blt.yml', TRUE);
$this->updater->moveFile('blt/project.local.yml', 'blt/local.yml', TRUE);
$this->updater->moveFile('blt/project.yml', 'blt/blt.yml', TRUE);
Expand All @@ -500,6 +507,7 @@ public function update_9000000() {
$project_config->set($new, $value);
$project_config->remove($original);
}
$this->updater->writeProjectYml($project_yml);

$process = new Process("blt blt:init:settings", $this->updater->getRepoRoot());
$process->run();
Expand Down
6 changes: 3 additions & 3 deletions template/drush/sites/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
This directory should contain Drush site aliases. These aliases can be generated in several ways:
* Using the `blt generate:aliases` command (for Acquia Cloud applications)
* Using the `blt recipes:aliases:init:acquia` command (for Acquia Cloud applications)
* Using the [acsf-tools](https://github.com/acquia/acsf-tools) package
* By downloading aliases directly from Acquia Cloud (not recommended--use one of the above tools if possible)
* Using the `blt vm` command (for DrupalVM instances)
* Manually, based on the [Drush examples](https://raw.githubusercontent.com/drush-ops/drush/master/examples/example.site.yml).
* Using the `blt recipes:drupalvm:init ` command (for DrupalVM instances)
* Manually, based on the [Drush examples](https://raw.githubusercontent.com/drush-ops/drush/master/examples/example.site.yml).

0 comments on commit be40fef

Please sign in to comment.