diff --git a/src/Robo/Plugin/Commands/GetDBCommand.php b/src/Robo/Plugin/Commands/GetDBCommand.php index e8283c9..7018d81 100644 --- a/src/Robo/Plugin/Commands/GetDBCommand.php +++ b/src/Robo/Plugin/Commands/GetDBCommand.php @@ -42,6 +42,14 @@ public function getDB(ConsoleIO $io, array $args) { return 'Acquia CLI is not installed, please install and configure it: https://docs.acquia.com/acquia-cli/install/'; } break; + case 'platform': + if ($this->getCliToolStatus('platform')) { + $cmd = "platform db:dump --gzip --file=$dbFolder/site-db.sql.gz -p $remoteSiteName -e $remoteEnv"; + } + else { + return 'Platform CLI is not installed, please install and configure it: https://docs.platform.sh/administration/cli.html'; + } + break; case 'pantheon': default: if ($this->getCliToolStatus('terminus')) { diff --git a/src/Robo/Plugin/Commands/GetFilesCommand.php b/src/Robo/Plugin/Commands/GetFilesCommand.php index 8012cc1..26659f2 100644 --- a/src/Robo/Plugin/Commands/GetFilesCommand.php +++ b/src/Robo/Plugin/Commands/GetFilesCommand.php @@ -48,6 +48,9 @@ public function getFiles(ConsoleIO $io, $opts = ['no-download' => FALSE]) { case 'acquia': $tasks = $this->getFilesAcquia($io, $tasks, $remoteSiteName, $remoteEnv); break; + case 'platform': + $tasks = $this->getFilesPlatform($io, $tasks, $remoteSiteName, $remoteEnv); + break; case 'pantheon': default: $tasks = $this->getFilesPantheon($io, $opts, $tasks, $remoteSiteName, $remoteEnv, $origFilesFolder, $destFilesFolder); @@ -78,6 +81,7 @@ private function getFilesAcquia(ConsoleIO $io, $tasks, $remoteSiteName, $remoteE else { return 'Your Local env doesnt have a valid acquia project structure, your drupal root should be the "docroot" folder.'; } + return $tasks; } @@ -103,4 +107,26 @@ private function getFilesPantheon(ConsoleIO $io, array $opts, $tasks, $remoteSit return $tasks; } + + /** + * Helper function to get files from PlatformSH. + */ + private function getFilesPlatform(ConsoleIO $io, $tasks, $remoteSiteName, $remoteEnv) { + if (file_exists($this->getLocalEnvRoot() . '/web/sites/default/files')) { + if ($this->getCliToolStatus('platform')) { + $io->say('Syncing files from the ' . $remoteEnv . ' environment...'); + $cmd = "platform mount:download /mnt/files {$this->getLocalEnvRoot()}/web/sites/default/files -p $remoteSiteName -e $remoteEnv"; + $tasks->addTask($this->taskExec($cmd)); + } + else { + return 'Platform CLI is not installed, please install and configure it: https://docs.platform.sh/administration/cli.html'; + } + } + else { + return 'Your Local env doesnt have a valid platform project structure, your drupal root should be the "web" folder.'; + } + + return $tasks; + } + }