diff --git a/src/Robo/Plugin/Commands/DeployExportConfigCommand.php b/src/Robo/Plugin/Commands/DeployExportConfigCommand.php new file mode 100644 index 0000000..c40cbc7 --- /dev/null +++ b/src/Robo/Plugin/Commands/DeployExportConfigCommand.php @@ -0,0 +1,51 @@ +get('remote_platform'); + $remoteSiteName = Robo::config()->get('remote_sitename'); + $defaultCanonicalEnv = Robo::config()->get('remote_canonical_env'); + + $tasks = $this->collectionBuilder($io); + $confirmation = $io->confirm('You are about to get the lastest Database from a ' . $remotePlatform . ' envoriment and override your local env with, Do you want to continue?'); + if ($confirmation) { + $remoteEnv = $io->ask("From which enviroment would like to donwload the Database Copy?", $defaultCanonicalEnv); + if ($remotePlatform == 'pantheon') { + $tasks->addTask($this->taskExec('terminus backup:create ' . $remoteSiteName . '.' . $remoteEnv . ' --element=db')); + } + if ($remotePlatform == 'acquia') { + // @todo get the right database name ask to user or configure from fire.yml. + // Or automatically get it from acquia ? + $acquiaDb = 'my_db'; + //acli api:environments:database-backup-create + // https://docs.acquia.com/acquia-cloud-platform/add-ons/acquia-cli/commands/api:environments:database-backup-create + $tasks->addTask($this->task->taskExec('acli api:environments:database-backup-create ' . $remoteSiteName . '.' . $remoteEnv . ' ' . $acquiaDb)); + } + $tasks->addTask($this->taskExec('fire local:get-db')); + $tasks->addTask($this->taskExec('fire local:import-db')); + $tasks->addTask($this->taskExec('fire drush updb -- -y')); + $tasks->addTask($this->taskExec('fire drush cr -- -y')); + $tasks->addTask($this->taskExec('fire drush cex -- -y')); + } + return $tasks; + } +} diff --git a/src/Robo/Plugin/Commands/GetDBCommand.php b/src/Robo/Plugin/Commands/GetDBCommand.php index e8283c9..bd65f4b 100644 --- a/src/Robo/Plugin/Commands/GetDBCommand.php +++ b/src/Robo/Plugin/Commands/GetDBCommand.php @@ -52,6 +52,9 @@ public function getDB(ConsoleIO $io, array $args) { } break; } + if (file_exists($dbFolder . '/site-db.sql.gz')) { + $tasks->addTask($this->taskFilesystemStack()->remove($dbFolder . '/site-db.sql.gz')); + } $tasks->addTask($this->taskExec("$cmd")->args($args)); return $tasks;