From 4644ff8dced3c68caeee779c2e21d4ed2fbc35d4 Mon Sep 17 00:00:00 2001 From: Edwin Torrez Barrera Date: Mon, 1 Jul 2024 02:41:37 -0600 Subject: [PATCH 1/3] - Create a condition to download the DB from PlatformSH. --- src/Robo/Plugin/Commands/GetDBCommand.php | 8 ++++++++ 1 file changed, 8 insertions(+) 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')) { From 493c17061431c642735d290a510b263b9ece45fa Mon Sep 17 00:00:00 2001 From: Edwin Torrez Barrera Date: Mon, 1 Jul 2024 02:42:16 -0600 Subject: [PATCH 2/3] - Create a condition to download the files from PlatformSH. --- src/Robo/Plugin/Commands/GetFilesCommand.php | 26 ++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/Robo/Plugin/Commands/GetFilesCommand.php b/src/Robo/Plugin/Commands/GetFilesCommand.php index 8012cc1..651b088 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('acli')) { + $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; + } + } From 72363ded72ef67eb8c41036a50dd8c026158a9c1 Mon Sep 17 00:00:00 2001 From: Edwin Torrez Barrera Date: Fri, 5 Jul 2024 17:27:00 -0600 Subject: [PATCH 3/3] - Fix name of cli for the platform command. --- src/Robo/Plugin/Commands/GetFilesCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Robo/Plugin/Commands/GetFilesCommand.php b/src/Robo/Plugin/Commands/GetFilesCommand.php index 651b088..26659f2 100644 --- a/src/Robo/Plugin/Commands/GetFilesCommand.php +++ b/src/Robo/Plugin/Commands/GetFilesCommand.php @@ -113,7 +113,7 @@ private function getFilesPantheon(ConsoleIO $io, array $opts, $tasks, $remoteSit */ private function getFilesPlatform(ConsoleIO $io, $tasks, $remoteSiteName, $remoteEnv) { if (file_exists($this->getLocalEnvRoot() . '/web/sites/default/files')) { - if ($this->getCliToolStatus('acli')) { + 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));