Skip to content

Commit

Permalink
CLI-998: Error downloading dbs (#1438)
Browse files Browse the repository at this point in the history
  • Loading branch information
danepowell authored Mar 21, 2023
1 parent 6eb9b77 commit b398a6a
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/Command/Pull/PullCommandBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Acquia\DrupalEnvironmentDetector\AcquiaDrupalEnvironmentDetector;
use AcquiaCloudApi\Connector\Client;
use AcquiaCloudApi\Endpoints\DatabaseBackups;
use AcquiaCloudApi\Endpoints\Databases;
use AcquiaCloudApi\Endpoints\Domains;
use AcquiaCloudApi\Endpoints\Environments;
use AcquiaCloudApi\Response\BackupResponse;
Expand Down Expand Up @@ -640,10 +641,8 @@ private function rsyncFilesFromCloud($chosen_environment, Closure $output_callba
* @throws \JsonException
*/
protected function determineCloudDatabases(Client $acquia_cloud_client, EnvironmentResponse $chosen_environment, string $site = NULL, bool $multiple_dbs = FALSE): array {
$databases = $acquia_cloud_client->request(
'get',
'/environments/' . $chosen_environment->uuid . '/databases'
);
$databases_request = new Databases($acquia_cloud_client);
$databases = $databases_request->getAll($chosen_environment->uuid);

if (count($databases) > 1) {
$this->logger->debug('Multiple databases detected on Cloud');
Expand All @@ -652,7 +651,7 @@ protected function determineCloudDatabases(Client $acquia_cloud_client, Environm
$this->logger->debug('Site is set to default. Assuming default database');
$site = self::getSiteGroupFromSshUrl($chosen_environment->sshUrl);
}
$database_names = array_column($databases, 'name');
$database_names = array_column((array) $databases, 'name');
$database_key = array_search($site, $database_names, TRUE);
if ($database_key !== FALSE) {
return [$databases[$database_key]];
Expand Down

0 comments on commit b398a6a

Please sign in to comment.