From c84588353e41fd4d745094edb31fff23f46da061 Mon Sep 17 00:00:00 2001 From: Dane Powell Date: Thu, 10 Oct 2024 12:35:53 -0700 Subject: [PATCH 1/7] CLI-1402: Require view database connection details permission --- composer.json | 2 +- composer.lock | 316 +++++++++--------- .../{RequireDb.php => RequireLocalDb.php} | 2 +- src/Attribute/RequireRemoteDb.php | 13 + src/Command/Archive/ArchiveExportCommand.php | 4 +- src/Command/CommandBase.php | 15 +- src/Command/Pull/PullCodeCommand.php | 4 +- src/Command/Pull/PullCommand.php | 4 +- src/Command/Pull/PullDatabaseCommand.php | 6 +- src/Command/Push/PushDatabaseCommand.php | 6 +- src/EventListener/ExceptionListener.php | 3 + 11 files changed, 207 insertions(+), 168 deletions(-) rename src/Attribute/{RequireDb.php => RequireLocalDb.php} (88%) create mode 100644 src/Attribute/RequireRemoteDb.php diff --git a/composer.json b/composer.json index 96bc0cb29..9a81935e0 100644 --- a/composer.json +++ b/composer.json @@ -47,7 +47,7 @@ "symfony/yaml": "^6.3", "thecodingmachine/safe": "^2.4", "typhonius/acquia-logstream": "^0.0.13", - "typhonius/acquia-php-sdk-v2": "^3.1.1", + "typhonius/acquia-php-sdk-v2": "dev-master as 3.3.1", "vlucas/phpdotenv": "^5.5", "zumba/amplitude-php": "^1.0.4" }, diff --git a/composer.lock b/composer.lock index bac221c78..825186074 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "9d66b0e2ace0f3912c36e459e9bdba7b", + "content-hash": "4d77b0ce2e0830db8a50cf7305df60c5", "packages": [ { "name": "acquia/drupal-environment-detector", @@ -250,16 +250,16 @@ }, { "name": "composer/ca-bundle", - "version": "1.5.1", + "version": "1.5.2", "source": { "type": "git", "url": "https://github.com/composer/ca-bundle.git", - "reference": "063d9aa8696582f5a41dffbbaf3c81024f0a604a" + "reference": "48a792895a2b7a6ee65dd5442c299d7b835b6137" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/ca-bundle/zipball/063d9aa8696582f5a41dffbbaf3c81024f0a604a", - "reference": "063d9aa8696582f5a41dffbbaf3c81024f0a604a", + "url": "https://api.github.com/repos/composer/ca-bundle/zipball/48a792895a2b7a6ee65dd5442c299d7b835b6137", + "reference": "48a792895a2b7a6ee65dd5442c299d7b835b6137", "shasum": "" }, "require": { @@ -269,8 +269,8 @@ }, "require-dev": { "phpstan/phpstan": "^1.10", + "phpunit/phpunit": "^8 || ^9", "psr/log": "^1.0 || ^2.0 || ^3.0", - "symfony/phpunit-bridge": "^4.2 || ^5", "symfony/process": "^4.0 || ^5.0 || ^6.0 || ^7.0" }, "type": "library", @@ -306,7 +306,7 @@ "support": { "irc": "irc://irc.freenode.org/composer", "issues": "https://github.com/composer/ca-bundle/issues", - "source": "https://github.com/composer/ca-bundle/tree/1.5.1" + "source": "https://github.com/composer/ca-bundle/tree/1.5.2" }, "funding": [ { @@ -322,7 +322,7 @@ "type": "tidelift" } ], - "time": "2024-07-08T15:28:20+00:00" + "time": "2024-09-25T07:49:53+00:00" }, { "name": "composer/semver", @@ -1402,16 +1402,16 @@ }, { "name": "league/csv", - "version": "9.16.0", + "version": "9.17.0", "source": { "type": "git", "url": "https://github.com/thephpleague/csv.git", - "reference": "998280c6c34bd67d8125fdc8b45bae28d761b440" + "reference": "8cab815fb11ec93aa2f7b8a57b3daa1f1a364011" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/csv/zipball/998280c6c34bd67d8125fdc8b45bae28d761b440", - "reference": "998280c6c34bd67d8125fdc8b45bae28d761b440", + "url": "https://api.github.com/repos/thephpleague/csv/zipball/8cab815fb11ec93aa2f7b8a57b3daa1f1a364011", + "reference": "8cab815fb11ec93aa2f7b8a57b3daa1f1a364011", "shasum": "" }, "require": { @@ -1419,17 +1419,16 @@ "php": "^8.1.2" }, "require-dev": { - "doctrine/collections": "^2.2.2", "ext-dom": "*", "ext-xdebug": "*", - "friendsofphp/php-cs-fixer": "^3.57.1", - "phpbench/phpbench": "^1.2.15", - "phpstan/phpstan": "^1.11.1", - "phpstan/phpstan-deprecation-rules": "^1.2.0", + "friendsofphp/php-cs-fixer": "^3.64.0", + "phpbench/phpbench": "^1.3.1", + "phpstan/phpstan": "^1.12.5", + "phpstan/phpstan-deprecation-rules": "^1.2.1", "phpstan/phpstan-phpunit": "^1.4.0", - "phpstan/phpstan-strict-rules": "^1.6.0", - "phpunit/phpunit": "^10.5.16 || ^11.1.3", - "symfony/var-dumper": "^6.4.6 || ^7.0.7" + "phpstan/phpstan-strict-rules": "^1.6.1", + "phpunit/phpunit": "^10.5.16 || ^11.4.0", + "symfony/var-dumper": "^6.4.8 || ^7.1.5" }, "suggest": { "ext-dom": "Required to use the XMLConverter and the HTMLConverter classes", @@ -1447,7 +1446,7 @@ "src/functions_include.php" ], "psr-4": { - "League\\Csv\\": "src" + "League\\Csv\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -1486,7 +1485,7 @@ "type": "github" } ], - "time": "2024-05-24T11:04:54+00:00" + "time": "2024-10-10T10:30:28+00:00" }, { "name": "league/oauth2-client", @@ -2145,16 +2144,16 @@ }, { "name": "php-http/discovery", - "version": "1.19.4", + "version": "1.20.0", "source": { "type": "git", "url": "https://github.com/php-http/discovery.git", - "reference": "0700efda8d7526335132360167315fdab3aeb599" + "reference": "82fe4c73ef3363caed49ff8dd1539ba06044910d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-http/discovery/zipball/0700efda8d7526335132360167315fdab3aeb599", - "reference": "0700efda8d7526335132360167315fdab3aeb599", + "url": "https://api.github.com/repos/php-http/discovery/zipball/82fe4c73ef3363caed49ff8dd1539ba06044910d", + "reference": "82fe4c73ef3363caed49ff8dd1539ba06044910d", "shasum": "" }, "require": { @@ -2218,9 +2217,9 @@ ], "support": { "issues": "https://github.com/php-http/discovery/issues", - "source": "https://github.com/php-http/discovery/tree/1.19.4" + "source": "https://github.com/php-http/discovery/tree/1.20.0" }, - "time": "2024-03-29T13:00:05+00:00" + "time": "2024-10-02T11:20:13+00:00" }, { "name": "php-http/httplug", @@ -3677,16 +3676,16 @@ }, { "name": "symfony/cache", - "version": "v6.4.11", + "version": "v6.4.12", "source": { "type": "git", "url": "https://github.com/symfony/cache.git", - "reference": "36daef8fce88fe0b9a4f8cf4c342ced5c05616dc" + "reference": "a463451b7f6ac4a47b98dbfc78ec2d3560c759d8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/cache/zipball/36daef8fce88fe0b9a4f8cf4c342ced5c05616dc", - "reference": "36daef8fce88fe0b9a4f8cf4c342ced5c05616dc", + "url": "https://api.github.com/repos/symfony/cache/zipball/a463451b7f6ac4a47b98dbfc78ec2d3560c759d8", + "reference": "a463451b7f6ac4a47b98dbfc78ec2d3560c759d8", "shasum": "" }, "require": { @@ -3753,7 +3752,7 @@ "psr6" ], "support": { - "source": "https://github.com/symfony/cache/tree/v6.4.11" + "source": "https://github.com/symfony/cache/tree/v6.4.12" }, "funding": [ { @@ -3769,7 +3768,7 @@ "type": "tidelift" } ], - "time": "2024-08-05T07:40:31+00:00" + "time": "2024-09-16T16:01:33+00:00" }, { "name": "symfony/cache-contracts", @@ -3924,16 +3923,16 @@ }, { "name": "symfony/console", - "version": "v6.4.11", + "version": "v6.4.12", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "42686880adaacdad1835ee8fc2a9ec5b7bd63998" + "reference": "72d080eb9edf80e36c19be61f72c98ed8273b765" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/42686880adaacdad1835ee8fc2a9ec5b7bd63998", - "reference": "42686880adaacdad1835ee8fc2a9ec5b7bd63998", + "url": "https://api.github.com/repos/symfony/console/zipball/72d080eb9edf80e36c19be61f72c98ed8273b765", + "reference": "72d080eb9edf80e36c19be61f72c98ed8273b765", "shasum": "" }, "require": { @@ -3998,7 +3997,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v6.4.11" + "source": "https://github.com/symfony/console/tree/v6.4.12" }, "funding": [ { @@ -4014,20 +4013,20 @@ "type": "tidelift" } ], - "time": "2024-08-15T22:48:29+00:00" + "time": "2024-09-20T08:15:52+00:00" }, { "name": "symfony/dependency-injection", - "version": "v6.4.11", + "version": "v6.4.12", "source": { "type": "git", "url": "https://github.com/symfony/dependency-injection.git", - "reference": "e93c8368dc9915c2fe12018ff22fcbbdd32c9a9e" + "reference": "cfb9d34a1cdd4911bc737a5358fd1cf8ebfb536e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/e93c8368dc9915c2fe12018ff22fcbbdd32c9a9e", - "reference": "e93c8368dc9915c2fe12018ff22fcbbdd32c9a9e", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/cfb9d34a1cdd4911bc737a5358fd1cf8ebfb536e", + "reference": "cfb9d34a1cdd4911bc737a5358fd1cf8ebfb536e", "shasum": "" }, "require": { @@ -4079,7 +4078,7 @@ "description": "Allows you to standardize and centralize the way objects are constructed in your application", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/dependency-injection/tree/v6.4.11" + "source": "https://github.com/symfony/dependency-injection/tree/v6.4.12" }, "funding": [ { @@ -4095,7 +4094,7 @@ "type": "tidelift" } ], - "time": "2024-08-29T08:15:38+00:00" + "time": "2024-09-20T08:18:25+00:00" }, { "name": "symfony/deprecation-contracts", @@ -4166,16 +4165,16 @@ }, { "name": "symfony/dotenv", - "version": "v6.4.10", + "version": "v6.4.12", "source": { "type": "git", "url": "https://github.com/symfony/dotenv.git", - "reference": "2ae0c84cc9be0dc1eeb86016970b63c764d8472e" + "reference": "815284236cab7d8e1280f53bf562c07a4dfe5954" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dotenv/zipball/2ae0c84cc9be0dc1eeb86016970b63c764d8472e", - "reference": "2ae0c84cc9be0dc1eeb86016970b63c764d8472e", + "url": "https://api.github.com/repos/symfony/dotenv/zipball/815284236cab7d8e1280f53bf562c07a4dfe5954", + "reference": "815284236cab7d8e1280f53bf562c07a4dfe5954", "shasum": "" }, "require": { @@ -4220,7 +4219,7 @@ "environment" ], "support": { - "source": "https://github.com/symfony/dotenv/tree/v6.4.10" + "source": "https://github.com/symfony/dotenv/tree/v6.4.12" }, "funding": [ { @@ -4236,7 +4235,7 @@ "type": "tidelift" } ], - "time": "2024-07-09T18:29:35+00:00" + "time": "2024-09-16T16:01:33+00:00" }, { "name": "symfony/error-handler", @@ -4535,16 +4534,16 @@ }, { "name": "symfony/filesystem", - "version": "v6.4.9", + "version": "v6.4.12", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "b51ef8059159330b74a4d52f68e671033c0fe463" + "reference": "f810e3cbdf7fdc35983968523d09f349fa9ada12" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/b51ef8059159330b74a4d52f68e671033c0fe463", - "reference": "b51ef8059159330b74a4d52f68e671033c0fe463", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/f810e3cbdf7fdc35983968523d09f349fa9ada12", + "reference": "f810e3cbdf7fdc35983968523d09f349fa9ada12", "shasum": "" }, "require": { @@ -4581,7 +4580,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v6.4.9" + "source": "https://github.com/symfony/filesystem/tree/v6.4.12" }, "funding": [ { @@ -4597,7 +4596,7 @@ "type": "tidelift" } ], - "time": "2024-06-28T09:49:33+00:00" + "time": "2024-09-16T16:01:33+00:00" }, { "name": "symfony/finder", @@ -4733,16 +4732,16 @@ }, { "name": "symfony/http-foundation", - "version": "v6.4.10", + "version": "v6.4.12", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "117f1f20a7ade7bcea28b861fb79160a21a1e37b" + "reference": "133ac043875f59c26c55e79cf074562127cce4d2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/117f1f20a7ade7bcea28b861fb79160a21a1e37b", - "reference": "117f1f20a7ade7bcea28b861fb79160a21a1e37b", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/133ac043875f59c26c55e79cf074562127cce4d2", + "reference": "133ac043875f59c26c55e79cf074562127cce4d2", "shasum": "" }, "require": { @@ -4790,7 +4789,7 @@ "description": "Defines an object-oriented layer for the HTTP specification", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-foundation/tree/v6.4.10" + "source": "https://github.com/symfony/http-foundation/tree/v6.4.12" }, "funding": [ { @@ -4806,20 +4805,20 @@ "type": "tidelift" } ], - "time": "2024-07-26T12:36:27+00:00" + "time": "2024-09-20T08:18:25+00:00" }, { "name": "symfony/http-kernel", - "version": "v6.4.11", + "version": "v6.4.12", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "1ba6b89d781cb47448155cc70dd2e0f1b0584c79" + "reference": "96df83d51b5f78804f70c093b97310794fd6257b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/1ba6b89d781cb47448155cc70dd2e0f1b0584c79", - "reference": "1ba6b89d781cb47448155cc70dd2e0f1b0584c79", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/96df83d51b5f78804f70c093b97310794fd6257b", + "reference": "96df83d51b5f78804f70c093b97310794fd6257b", "shasum": "" }, "require": { @@ -4904,7 +4903,7 @@ "description": "Provides a structured process for converting a Request into a Response", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-kernel/tree/v6.4.11" + "source": "https://github.com/symfony/http-kernel/tree/v6.4.12" }, "funding": [ { @@ -4920,7 +4919,7 @@ "type": "tidelift" } ], - "time": "2024-08-30T16:57:20+00:00" + "time": "2024-09-21T06:02:57+00:00" }, { "name": "symfony/options-resolver", @@ -5465,16 +5464,16 @@ }, { "name": "symfony/process", - "version": "v6.4.8", + "version": "v6.4.12", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "8d92dd79149f29e89ee0f480254db595f6a6a2c5" + "reference": "3f94e5f13ff58df371a7ead461b6e8068900fbb3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/8d92dd79149f29e89ee0f480254db595f6a6a2c5", - "reference": "8d92dd79149f29e89ee0f480254db595f6a6a2c5", + "url": "https://api.github.com/repos/symfony/process/zipball/3f94e5f13ff58df371a7ead461b6e8068900fbb3", + "reference": "3f94e5f13ff58df371a7ead461b6e8068900fbb3", "shasum": "" }, "require": { @@ -5506,7 +5505,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v6.4.8" + "source": "https://github.com/symfony/process/tree/v6.4.12" }, "funding": [ { @@ -5522,7 +5521,7 @@ "type": "tidelift" } ], - "time": "2024-05-31T14:49:08+00:00" + "time": "2024-09-17T12:47:12+00:00" }, { "name": "symfony/service-contracts", @@ -5609,16 +5608,16 @@ }, { "name": "symfony/string", - "version": "v6.4.11", + "version": "v6.4.12", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "5bc3eb632cf9c8dbfd6529d89be9950d1518883b" + "reference": "f8a1ccebd0997e16112dfecfd74220b78e5b284b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/5bc3eb632cf9c8dbfd6529d89be9950d1518883b", - "reference": "5bc3eb632cf9c8dbfd6529d89be9950d1518883b", + "url": "https://api.github.com/repos/symfony/string/zipball/f8a1ccebd0997e16112dfecfd74220b78e5b284b", + "reference": "f8a1ccebd0997e16112dfecfd74220b78e5b284b", "shasum": "" }, "require": { @@ -5675,7 +5674,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v6.4.11" + "source": "https://github.com/symfony/string/tree/v6.4.12" }, "funding": [ { @@ -5691,7 +5690,7 @@ "type": "tidelift" } ], - "time": "2024-08-12T09:55:28+00:00" + "time": "2024-09-20T08:15:52+00:00" }, { "name": "symfony/translation-contracts", @@ -5773,16 +5772,16 @@ }, { "name": "symfony/validator", - "version": "v6.4.11", + "version": "v6.4.12", "source": { "type": "git", "url": "https://github.com/symfony/validator.git", - "reference": "4ff41cf10af1de99ad92895411b55c9f309bc2d8" + "reference": "6da1f0a1ee73d060a411d832cbe0539cfe9bbaa0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/validator/zipball/4ff41cf10af1de99ad92895411b55c9f309bc2d8", - "reference": "4ff41cf10af1de99ad92895411b55c9f309bc2d8", + "url": "https://api.github.com/repos/symfony/validator/zipball/6da1f0a1ee73d060a411d832cbe0539cfe9bbaa0", + "reference": "6da1f0a1ee73d060a411d832cbe0539cfe9bbaa0", "shasum": "" }, "require": { @@ -5850,7 +5849,7 @@ "description": "Provides tools to validate values", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/validator/tree/v6.4.11" + "source": "https://github.com/symfony/validator/tree/v6.4.12" }, "funding": [ { @@ -5866,7 +5865,7 @@ "type": "tidelift" } ], - "time": "2024-08-30T15:57:55+00:00" + "time": "2024-09-20T08:18:25+00:00" }, { "name": "symfony/var-dumper", @@ -6032,16 +6031,16 @@ }, { "name": "symfony/yaml", - "version": "v6.4.11", + "version": "v6.4.12", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "be37e7f13195e05ab84ca5269365591edd240335" + "reference": "762ee56b2649659380e0ef4d592d807bc17b7971" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/be37e7f13195e05ab84ca5269365591edd240335", - "reference": "be37e7f13195e05ab84ca5269365591edd240335", + "url": "https://api.github.com/repos/symfony/yaml/zipball/762ee56b2649659380e0ef4d592d807bc17b7971", + "reference": "762ee56b2649659380e0ef4d592d807bc17b7971", "shasum": "" }, "require": { @@ -6084,7 +6083,7 @@ "description": "Loads and dumps YAML files", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/yaml/tree/v6.4.11" + "source": "https://github.com/symfony/yaml/tree/v6.4.12" }, "funding": [ { @@ -6100,7 +6099,7 @@ "type": "tidelift" } ], - "time": "2024-08-12T09:55:28+00:00" + "time": "2024-09-17T12:47:12+00:00" }, { "name": "thecodingmachine/safe", @@ -6299,16 +6298,16 @@ }, { "name": "typhonius/acquia-php-sdk-v2", - "version": "3.3.1", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/typhonius/acquia-php-sdk-v2.git", - "reference": "7cc0c773ea15d82ab7268266097c846d5814be87" + "reference": "c6c8370e84e11d1ee18d89a3b5a4d5a8ed0b4474" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/typhonius/acquia-php-sdk-v2/zipball/7cc0c773ea15d82ab7268266097c846d5814be87", - "reference": "7cc0c773ea15d82ab7268266097c846d5814be87", + "url": "https://api.github.com/repos/typhonius/acquia-php-sdk-v2/zipball/c6c8370e84e11d1ee18d89a3b5a4d5a8ed0b4474", + "reference": "c6c8370e84e11d1ee18d89a3b5a4d5a8ed0b4474", "shasum": "" }, "require": { @@ -6330,6 +6329,7 @@ "slevomat/coding-standard": "^8.4", "squizlabs/php_codesniffer": "^3.9.1" }, + "default-branch": true, "type": "library", "autoload": { "psr-4": { @@ -6352,7 +6352,7 @@ "description": "A PHP SDK for Acquia CloudAPI v2", "support": { "issues": "https://github.com/typhonius/acquia-php-sdk-v2/issues", - "source": "https://github.com/typhonius/acquia-php-sdk-v2/tree/3.3.1" + "source": "https://github.com/typhonius/acquia-php-sdk-v2/tree/master" }, "funding": [ { @@ -6360,7 +6360,7 @@ "type": "github" } ], - "time": "2024-08-18T17:56:11+00:00" + "time": "2024-10-10T19:26:23+00:00" }, { "name": "vlucas/phpdotenv", @@ -7612,16 +7612,16 @@ }, { "name": "composer/class-map-generator", - "version": "1.3.4", + "version": "1.4.0", "source": { "type": "git", "url": "https://github.com/composer/class-map-generator.git", - "reference": "b1b3fd0b4eaf3ddf3ee230bc340bf3fff454a1a3" + "reference": "98bbf6780e56e0fd2404fe4b82eb665a0f93b783" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/class-map-generator/zipball/b1b3fd0b4eaf3ddf3ee230bc340bf3fff454a1a3", - "reference": "b1b3fd0b4eaf3ddf3ee230bc340bf3fff454a1a3", + "url": "https://api.github.com/repos/composer/class-map-generator/zipball/98bbf6780e56e0fd2404fe4b82eb665a0f93b783", + "reference": "98bbf6780e56e0fd2404fe4b82eb665a0f93b783", "shasum": "" }, "require": { @@ -7634,8 +7634,8 @@ "phpstan/phpstan-deprecation-rules": "^1", "phpstan/phpstan-phpunit": "^1", "phpstan/phpstan-strict-rules": "^1.1", - "symfony/filesystem": "^5.4 || ^6", - "symfony/phpunit-bridge": "^5" + "phpunit/phpunit": "^8", + "symfony/filesystem": "^5.4 || ^6" }, "type": "library", "extra": { @@ -7665,7 +7665,7 @@ ], "support": { "issues": "https://github.com/composer/class-map-generator/issues", - "source": "https://github.com/composer/class-map-generator/tree/1.3.4" + "source": "https://github.com/composer/class-map-generator/tree/1.4.0" }, "funding": [ { @@ -7681,25 +7681,25 @@ "type": "tidelift" } ], - "time": "2024-06-12T14:13:04+00:00" + "time": "2024-10-03T18:14:00+00:00" }, { "name": "composer/composer", - "version": "2.7.9", + "version": "2.8.1", "source": { "type": "git", "url": "https://github.com/composer/composer.git", - "reference": "e30ccdd665828ae66eb1be78f056e39e1d5f55ab" + "reference": "e52b8672276cf436670cdd6bd5de4353740e83b2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/composer/zipball/e30ccdd665828ae66eb1be78f056e39e1d5f55ab", - "reference": "e30ccdd665828ae66eb1be78f056e39e1d5f55ab", + "url": "https://api.github.com/repos/composer/composer/zipball/e52b8672276cf436670cdd6bd5de4353740e83b2", + "reference": "e52b8672276cf436670cdd6bd5de4353740e83b2", "shasum": "" }, "require": { "composer/ca-bundle": "^1.5", - "composer/class-map-generator": "^1.3.3", + "composer/class-map-generator": "^1.4.0", "composer/metadata-minifier": "^1.0", "composer/pcre": "^2.2 || ^3.2", "composer/semver": "^3.3", @@ -7739,7 +7739,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "2.7-dev" + "dev-main": "2.8-dev" }, "phpstan": { "includes": [ @@ -7779,7 +7779,7 @@ "irc": "ircs://irc.libera.chat:6697/composer", "issues": "https://github.com/composer/composer/issues", "security": "https://github.com/composer/composer/security/policy", - "source": "https://github.com/composer/composer/tree/2.7.9" + "source": "https://github.com/composer/composer/tree/2.8.1" }, "funding": [ { @@ -7795,7 +7795,7 @@ "type": "tidelift" } ], - "time": "2024-09-04T12:43:28+00:00" + "time": "2024-10-04T09:31:01+00:00" }, { "name": "composer/metadata-minifier", @@ -8483,16 +8483,16 @@ }, { "name": "drupal/coder", - "version": "8.3.24", + "version": "8.3.25", "source": { "type": "git", "url": "https://github.com/pfrenssen/coder.git", - "reference": "1a59890f972db5da091354f0191dec1037f7c582" + "reference": "c58e5a0c44c0010bbc8a91fc468f4667e177b976" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/pfrenssen/coder/zipball/1a59890f972db5da091354f0191dec1037f7c582", - "reference": "1a59890f972db5da091354f0191dec1037f7c582", + "url": "https://api.github.com/repos/pfrenssen/coder/zipball/c58e5a0c44c0010bbc8a91fc468f4667e177b976", + "reference": "c58e5a0c44c0010bbc8a91fc468f4667e177b976", "shasum": "" }, "require": { @@ -8530,7 +8530,7 @@ "issues": "https://www.drupal.org/project/issues/coder", "source": "https://www.drupal.org/project/coder" }, - "time": "2024-04-21T06:13:24+00:00" + "time": "2024-09-22T19:02:16+00:00" }, { "name": "fidry/cpu-core-counter", @@ -9215,16 +9215,16 @@ }, { "name": "laravel/serializable-closure", - "version": "v1.3.4", + "version": "v1.3.5", "source": { "type": "git", "url": "https://github.com/laravel/serializable-closure.git", - "reference": "61b87392d986dc49ad5ef64e75b1ff5fee24ef81" + "reference": "1dc4a3dbfa2b7628a3114e43e32120cce7cdda9c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/serializable-closure/zipball/61b87392d986dc49ad5ef64e75b1ff5fee24ef81", - "reference": "61b87392d986dc49ad5ef64e75b1ff5fee24ef81", + "url": "https://api.github.com/repos/laravel/serializable-closure/zipball/1dc4a3dbfa2b7628a3114e43e32120cce7cdda9c", + "reference": "1dc4a3dbfa2b7628a3114e43e32120cce7cdda9c", "shasum": "" }, "require": { @@ -9272,7 +9272,7 @@ "issues": "https://github.com/laravel/serializable-closure/issues", "source": "https://github.com/laravel/serializable-closure" }, - "time": "2024-08-02T07:48:17+00:00" + "time": "2024-09-23T13:33:08+00:00" }, { "name": "league/uri", @@ -9730,16 +9730,16 @@ }, { "name": "nikic/php-parser", - "version": "v4.19.1", + "version": "v4.19.4", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "4e1b88d21c69391150ace211e9eaf05810858d0b" + "reference": "715f4d25e225bc47b293a8b997fe6ce99bf987d2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/4e1b88d21c69391150ace211e9eaf05810858d0b", - "reference": "4e1b88d21c69391150ace211e9eaf05810858d0b", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/715f4d25e225bc47b293a8b997fe6ce99bf987d2", + "reference": "715f4d25e225bc47b293a8b997fe6ce99bf987d2", "shasum": "" }, "require": { @@ -9748,7 +9748,7 @@ }, "require-dev": { "ircmaxell/php-yacc": "^0.0.7", - "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0" + "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" }, "bin": [ "bin/php-parse" @@ -9780,9 +9780,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.19.1" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.19.4" }, - "time": "2024-03-17T08:10:35+00:00" + "time": "2024-09-29T15:01:53+00:00" }, { "name": "ondram/ci-detector", @@ -10601,16 +10601,16 @@ }, { "name": "phpstan/phpdoc-parser", - "version": "1.30.1", + "version": "1.32.0", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "51b95ec8670af41009e2b2b56873bad96682413e" + "reference": "6ca22b154efdd9e3c68c56f5d94670920a1c19a4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/51b95ec8670af41009e2b2b56873bad96682413e", - "reference": "51b95ec8670af41009e2b2b56873bad96682413e", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/6ca22b154efdd9e3c68c56f5d94670920a1c19a4", + "reference": "6ca22b154efdd9e3c68c56f5d94670920a1c19a4", "shasum": "" }, "require": { @@ -10642,9 +10642,9 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/1.30.1" + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.32.0" }, - "time": "2024-09-07T20:13:05+00:00" + "time": "2024-09-26T07:23:32+00:00" }, { "name": "phpstan/phpstan", @@ -11072,16 +11072,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.6.20", + "version": "9.6.21", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "49d7820565836236411f5dc002d16dd689cde42f" + "reference": "de6abf3b6f8dd955fac3caad3af7a9504e8c2ffa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/49d7820565836236411f5dc002d16dd689cde42f", - "reference": "49d7820565836236411f5dc002d16dd689cde42f", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/de6abf3b6f8dd955fac3caad3af7a9504e8c2ffa", + "reference": "de6abf3b6f8dd955fac3caad3af7a9504e8c2ffa", "shasum": "" }, "require": { @@ -11096,7 +11096,7 @@ "phar-io/manifest": "^2.0.4", "phar-io/version": "^3.2.1", "php": ">=7.3", - "phpunit/php-code-coverage": "^9.2.31", + "phpunit/php-code-coverage": "^9.2.32", "phpunit/php-file-iterator": "^3.0.6", "phpunit/php-invoker": "^3.1.1", "phpunit/php-text-template": "^2.0.4", @@ -11155,7 +11155,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.20" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.21" }, "funding": [ { @@ -11171,7 +11171,7 @@ "type": "tidelift" } ], - "time": "2024-07-10T11:45:39+00:00" + "time": "2024-09-19T10:50:18+00:00" }, { "name": "psr/simple-cache", @@ -12831,16 +12831,16 @@ }, { "name": "symfony/dom-crawler", - "version": "v6.4.8", + "version": "v6.4.12", "source": { "type": "git", "url": "https://github.com/symfony/dom-crawler.git", - "reference": "105b56a0305d219349edeb60a800082eca864e4b" + "reference": "9d307ecbcb917001692be333cdc58f474fdb37f0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/105b56a0305d219349edeb60a800082eca864e4b", - "reference": "105b56a0305d219349edeb60a800082eca864e4b", + "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/9d307ecbcb917001692be333cdc58f474fdb37f0", + "reference": "9d307ecbcb917001692be333cdc58f474fdb37f0", "shasum": "" }, "require": { @@ -12878,7 +12878,7 @@ "description": "Eases DOM navigation for HTML and XML documents", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/dom-crawler/tree/v6.4.8" + "source": "https://github.com/symfony/dom-crawler/tree/v6.4.12" }, "funding": [ { @@ -12894,7 +12894,7 @@ "type": "tidelift" } ], - "time": "2024-05-31T14:49:08+00:00" + "time": "2024-09-15T06:35:36+00:00" }, { "name": "symfony/polyfill-php73", @@ -13242,17 +13242,25 @@ "version": "3.0.0.0-alpha2", "alias": "2.1.0", "alias_normalized": "2.1.0.0" + }, + { + "package": "typhonius/acquia-php-sdk-v2", + "version": "9999999-dev", + "alias": "3.3.1", + "alias_normalized": "3.3.1.0" } ], "minimum-stability": "dev", - "stability-flags": [], + "stability-flags": { + "typhonius/acquia-php-sdk-v2": 20 + }, "prefer-stable": true, "prefer-lowest": false, "platform": { "php": "^8.1", "ext-json": "*" }, - "platform-dev": [], + "platform-dev": {}, "platform-overrides": { "php": "8.1.25" }, diff --git a/src/Attribute/RequireDb.php b/src/Attribute/RequireLocalDb.php similarity index 88% rename from src/Attribute/RequireDb.php rename to src/Attribute/RequireLocalDb.php index b178ded99..d08b2ed49 100644 --- a/src/Attribute/RequireDb.php +++ b/src/Attribute/RequireLocalDb.php @@ -8,6 +8,6 @@ * Specify that a command requires authentication. */ #[\Attribute(\Attribute::TARGET_CLASS)] -class RequireDb +class RequireLocalDb { } diff --git a/src/Attribute/RequireRemoteDb.php b/src/Attribute/RequireRemoteDb.php new file mode 100644 index 000000000..df059187c --- /dev/null +++ b/src/Attribute/RequireRemoteDb.php @@ -0,0 +1,13 @@ +getAttributes(RequireAuth::class)) { $this->appendHelp('This command requires authentication via the Cloud Platform API.'); } - if ((new \ReflectionClass(static::class))->getAttributes(RequireDb::class)) { + if ((new \ReflectionClass(static::class))->getAttributes(RequireLocalDb::class)) { $this->appendHelp('This command requires an active database connection. Set the following environment variables prior to running this command: ' . 'ACLI_DB_HOST, ACLI_DB_NAME, ACLI_DB_USER, ACLI_DB_PASSWORD'); } + if ((new \ReflectionClass(static::class))->getAttributes(RequireRemoteDb::class)) { + $this->appendHelp('This command requires the \'View database connection details\' permission.'); + } } public function appendHelp(string $helpText): void @@ -521,11 +526,17 @@ protected function getLocalFilesDir(string $site): string /** * @param string|null $site * @return DatabaseResponse[] + * @throws \Acquia\Cli\Exception\AcquiaCliException */ protected function determineCloudDatabases(Client $acquiaCloudClient, EnvironmentResponse $chosenEnvironment, string $site = null, bool $multipleDbs = false): array { $databasesRequest = new Databases($acquiaCloudClient); $databases = $databasesRequest->getAll($chosenEnvironment->uuid); + foreach ($databases as $database) { + if ($database->user_name === null) { + throw new AcquiaCliException('Database connection details missing'); + } + } if (count($databases) === 1) { $this->logger->debug('Only a single database detected on Cloud'); diff --git a/src/Command/Pull/PullCodeCommand.php b/src/Command/Pull/PullCodeCommand.php index 5a81a5022..39d106394 100644 --- a/src/Command/Pull/PullCodeCommand.php +++ b/src/Command/Pull/PullCodeCommand.php @@ -5,7 +5,7 @@ namespace Acquia\Cli\Command\Pull; use Acquia\Cli\Attribute\RequireAuth; -use Acquia\Cli\Attribute\RequireDb; +use Acquia\Cli\Attribute\RequireLocalDb; use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; @@ -14,7 +14,7 @@ use Symfony\Component\Console\Output\OutputInterface; #[RequireAuth] -#[RequireDb] +#[RequireLocalDb] #[AsCommand(name: 'pull:code', description: 'Copy code from a Cloud Platform environment')] final class PullCodeCommand extends PullCommandBase { diff --git a/src/Command/Pull/PullCommand.php b/src/Command/Pull/PullCommand.php index 2d50403cc..4b3295d57 100644 --- a/src/Command/Pull/PullCommand.php +++ b/src/Command/Pull/PullCommand.php @@ -5,7 +5,7 @@ namespace Acquia\Cli\Command\Pull; use Acquia\Cli\Attribute\RequireAuth; -use Acquia\Cli\Attribute\RequireDb; +use Acquia\Cli\Attribute\RequireLocalDb; use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; @@ -14,7 +14,7 @@ use Symfony\Component\Console\Output\OutputInterface; #[RequireAuth] -#[RequireDb] +#[RequireLocalDb] #[AsCommand(name: 'pull:all', description: 'Copy code, database, and files from a Cloud Platform environment', aliases: [ 'refresh', 'pull', diff --git a/src/Command/Pull/PullDatabaseCommand.php b/src/Command/Pull/PullDatabaseCommand.php index aa4acd7f9..ab0476e62 100644 --- a/src/Command/Pull/PullDatabaseCommand.php +++ b/src/Command/Pull/PullDatabaseCommand.php @@ -5,7 +5,8 @@ namespace Acquia\Cli\Command\Pull; use Acquia\Cli\Attribute\RequireAuth; -use Acquia\Cli\Attribute\RequireDb; +use Acquia\Cli\Attribute\RequireLocalDb; +use Acquia\Cli\Attribute\RequireRemoteDb; use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; @@ -13,7 +14,8 @@ use Symfony\Component\Console\Output\OutputInterface; #[RequireAuth] -#[RequireDb] +#[RequireLocalDb] +#[RequireRemoteDb] #[AsCommand(name: 'pull:database', description: 'Import database backup from a Cloud Platform environment', aliases: ['pull:db'])] final class PullDatabaseCommand extends PullCommandBase { diff --git a/src/Command/Push/PushDatabaseCommand.php b/src/Command/Push/PushDatabaseCommand.php index 26b0a7bd0..db2a60705 100644 --- a/src/Command/Push/PushDatabaseCommand.php +++ b/src/Command/Push/PushDatabaseCommand.php @@ -5,7 +5,8 @@ namespace Acquia\Cli\Command\Push; use Acquia\Cli\Attribute\RequireAuth; -use Acquia\Cli\Attribute\RequireDb; +use Acquia\Cli\Attribute\RequireLocalDb; +use Acquia\Cli\Attribute\RequireRemoteDb; use Acquia\Cli\Exception\AcquiaCliException; use Acquia\Cli\Output\Checklist; use AcquiaCloudApi\Response\DatabaseResponse; @@ -16,7 +17,8 @@ use Symfony\Component\Console\Output\OutputInterface; #[RequireAuth] -#[RequireDb] +#[RequireLocalDb] +#[RequireRemoteDb] #[AsCommand(name: 'push:database', description: 'Push a database from your local environment to a Cloud Platform environment', aliases: ['push:db'])] final class PushDatabaseCommand extends PushCommandBase { diff --git a/src/EventListener/ExceptionListener.php b/src/EventListener/ExceptionListener.php index e32a63db8..d716ca499 100644 --- a/src/EventListener/ExceptionListener.php +++ b/src/EventListener/ExceptionListener.php @@ -75,6 +75,9 @@ public function onConsoleError(ConsoleErrorEvent $event): void $this->helpMessages[] = 'Check for MySQL warnings above or in the server log (/var/log/mysql/error.log)'; $this->helpMessages[] = 'Frequently, `MySQL server has gone away` messages are caused by max_allowed_packet being exceeded.'; break; + case 'Database connection details missing': + $this->helpMessages[] = 'Check that you have the \'View database connection details\' permission'; + break; } } From db10a12e950479026044fda1a4e012510f2f54cc Mon Sep 17 00:00:00 2001 From: Dane Powell Date: Thu, 10 Oct 2024 12:37:53 -0700 Subject: [PATCH 2/7] Cleanup --- src/Attribute/RequireLocalDb.php | 2 +- src/Attribute/RequireRemoteDb.php | 2 +- src/Command/CommandBase.php | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Attribute/RequireLocalDb.php b/src/Attribute/RequireLocalDb.php index d08b2ed49..c472b536e 100644 --- a/src/Attribute/RequireLocalDb.php +++ b/src/Attribute/RequireLocalDb.php @@ -5,7 +5,7 @@ namespace Acquia\Cli\Attribute; /** - * Specify that a command requires authentication. + * Specify that a command requires local database. */ #[\Attribute(\Attribute::TARGET_CLASS)] class RequireLocalDb diff --git a/src/Attribute/RequireRemoteDb.php b/src/Attribute/RequireRemoteDb.php index df059187c..1d0ed13d7 100644 --- a/src/Attribute/RequireRemoteDb.php +++ b/src/Attribute/RequireRemoteDb.php @@ -5,7 +5,7 @@ namespace Acquia\Cli\Attribute; /** - * Specify that a command requires authentication. + * Specify that a command requires remote database. */ #[\Attribute(\Attribute::TARGET_CLASS)] class RequireRemoteDb diff --git a/src/Command/CommandBase.php b/src/Command/CommandBase.php index e9513fbef..cf9d1dd09 100644 --- a/src/Command/CommandBase.php +++ b/src/Command/CommandBase.php @@ -70,7 +70,6 @@ use Symfony\Component\Validator\Exception\ValidatorException; use Symfony\Component\Validator\Validation; use Symfony\Component\Yaml\Yaml; -use TypeError; use Zumba\Amplitude\Amplitude; abstract class CommandBase extends Command implements LoggerAwareInterface From 83358190abb70bd6f2020b97c3f1c32a0e425965 Mon Sep 17 00:00:00 2001 From: Dane Powell Date: Thu, 10 Oct 2024 12:40:34 -0700 Subject: [PATCH 3/7] add tests --- tests/phpunit/src/Misc/ExceptionListenerTest.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/phpunit/src/Misc/ExceptionListenerTest.php b/tests/phpunit/src/Misc/ExceptionListenerTest.php index fd6c26096..b8355a005 100644 --- a/tests/phpunit/src/Misc/ExceptionListenerTest.php +++ b/tests/phpunit/src/Misc/ExceptionListenerTest.php @@ -109,6 +109,10 @@ public function providerTestHelp(): array 'Frequently, `MySQL server has gone away` messages are caused by max_allowed_packet being exceeded.', ], ], + [ + new AcquiaCliException('Database connection details missing'), + 'Check that you have the \'View database connection details\' permission', + ], [ new ApiErrorException((object) [ 'error' => '', From 7ac94c44703642df4abb3d4c56791d38ff976a92 Mon Sep 17 00:00:00 2001 From: Dane Powell Date: Wed, 16 Oct 2024 15:11:05 -0700 Subject: [PATCH 4/7] stable sdk --- composer.json | 2 +- composer.lock | 53 +++++++++++++++++++++------------------------------ 2 files changed, 23 insertions(+), 32 deletions(-) diff --git a/composer.json b/composer.json index 9a81935e0..fbba42940 100644 --- a/composer.json +++ b/composer.json @@ -47,7 +47,7 @@ "symfony/yaml": "^6.3", "thecodingmachine/safe": "^2.4", "typhonius/acquia-logstream": "^0.0.13", - "typhonius/acquia-php-sdk-v2": "dev-master as 3.3.1", + "typhonius/acquia-php-sdk-v2": "^3.3.2", "vlucas/phpdotenv": "^5.5", "zumba/amplitude-php": "^1.0.4" }, diff --git a/composer.lock b/composer.lock index 825186074..0c8741487 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "4d77b0ce2e0830db8a50cf7305df60c5", + "content-hash": "beac6fb88c2275980a5ce7b23a9d6173", "packages": [ { "name": "acquia/drupal-environment-detector", @@ -6298,7 +6298,7 @@ }, { "name": "typhonius/acquia-php-sdk-v2", - "version": "dev-master", + "version": "3.3.2", "source": { "type": "git", "url": "https://github.com/typhonius/acquia-php-sdk-v2.git", @@ -6329,7 +6329,6 @@ "slevomat/coding-standard": "^8.4", "squizlabs/php_codesniffer": "^3.9.1" }, - "default-branch": true, "type": "library", "autoload": { "psr-4": { @@ -6352,7 +6351,7 @@ "description": "A PHP SDK for Acquia CloudAPI v2", "support": { "issues": "https://github.com/typhonius/acquia-php-sdk-v2/issues", - "source": "https://github.com/typhonius/acquia-php-sdk-v2/tree/master" + "source": "https://github.com/typhonius/acquia-php-sdk-v2/tree/3.3.2" }, "funding": [ { @@ -6879,16 +6878,16 @@ }, { "name": "amphp/parallel", - "version": "v2.2.9", + "version": "v2.3.0", "source": { "type": "git", "url": "https://github.com/amphp/parallel.git", - "reference": "73d293f1fc4df1bebc3c4fce1432e82dd7032238" + "reference": "9777db1460d1535bc2a843840684fb1205225b87" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/amphp/parallel/zipball/73d293f1fc4df1bebc3c4fce1432e82dd7032238", - "reference": "73d293f1fc4df1bebc3c4fce1432e82dd7032238", + "url": "https://api.github.com/repos/amphp/parallel/zipball/9777db1460d1535bc2a843840684fb1205225b87", + "reference": "9777db1460d1535bc2a843840684fb1205225b87", "shasum": "" }, "require": { @@ -6951,7 +6950,7 @@ ], "support": { "issues": "https://github.com/amphp/parallel/issues", - "source": "https://github.com/amphp/parallel/tree/v2.2.9" + "source": "https://github.com/amphp/parallel/tree/v2.3.0" }, "funding": [ { @@ -6959,7 +6958,7 @@ "type": "github" } ], - "time": "2024-03-24T18:27:44+00:00" + "time": "2024-09-14T19:16:14+00:00" }, { "name": "amphp/parser", @@ -9864,16 +9863,16 @@ }, { "name": "overtrue/phplint", - "version": "9.4.1", + "version": "9.4.2", "source": { "type": "git", "url": "https://github.com/overtrue/phplint.git", - "reference": "cec4a0dbb9d00077dafa2f0cd89f4ca532814276" + "reference": "bb849f012fa44839f5ba4a079dda6d2ef29d6fce" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/overtrue/phplint/zipball/cec4a0dbb9d00077dafa2f0cd89f4ca532814276", - "reference": "cec4a0dbb9d00077dafa2f0cd89f4ca532814276", + "url": "https://api.github.com/repos/overtrue/phplint/zipball/bb849f012fa44839f5ba4a079dda6d2ef29d6fce", + "reference": "bb849f012fa44839f5ba4a079dda6d2ef29d6fce", "shasum": "" }, "require": { @@ -9947,7 +9946,7 @@ ], "support": { "issues": "https://github.com/overtrue/phplint/issues", - "source": "https://github.com/overtrue/phplint/tree/9.4.1" + "source": "https://github.com/overtrue/phplint/tree/9.4.2" }, "funding": [ { @@ -9955,7 +9954,7 @@ "type": "github" } ], - "time": "2024-07-05T14:16:33+00:00" + "time": "2024-10-11T07:44:07+00:00" }, { "name": "phar-io/manifest", @@ -10601,16 +10600,16 @@ }, { "name": "phpstan/phpdoc-parser", - "version": "1.32.0", + "version": "1.33.0", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "6ca22b154efdd9e3c68c56f5d94670920a1c19a4" + "reference": "82a311fd3690fb2bf7b64d5c98f912b3dd746140" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/6ca22b154efdd9e3c68c56f5d94670920a1c19a4", - "reference": "6ca22b154efdd9e3c68c56f5d94670920a1c19a4", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/82a311fd3690fb2bf7b64d5c98f912b3dd746140", + "reference": "82a311fd3690fb2bf7b64d5c98f912b3dd746140", "shasum": "" }, "require": { @@ -10642,9 +10641,9 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/1.32.0" + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.33.0" }, - "time": "2024-09-26T07:23:32+00:00" + "time": "2024-10-13T11:25:22+00:00" }, { "name": "phpstan/phpstan", @@ -13242,18 +13241,10 @@ "version": "3.0.0.0-alpha2", "alias": "2.1.0", "alias_normalized": "2.1.0.0" - }, - { - "package": "typhonius/acquia-php-sdk-v2", - "version": "9999999-dev", - "alias": "3.3.1", - "alias_normalized": "3.3.1.0" } ], "minimum-stability": "dev", - "stability-flags": { - "typhonius/acquia-php-sdk-v2": 20 - }, + "stability-flags": {}, "prefer-stable": true, "prefer-lowest": false, "platform": { From e91ca09c9d29632c1ee181edc7443124a61acc26 Mon Sep 17 00:00:00 2001 From: Dane Powell Date: Wed, 16 Oct 2024 15:15:19 -0700 Subject: [PATCH 5/7] add help test --- .../phpunit/src/Commands/Pull/PullDatabaseCommandTest.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/phpunit/src/Commands/Pull/PullDatabaseCommandTest.php b/tests/phpunit/src/Commands/Pull/PullDatabaseCommandTest.php index 5fd11d7de..b0f5e353a 100644 --- a/tests/phpunit/src/Commands/Pull/PullDatabaseCommandTest.php +++ b/tests/phpunit/src/Commands/Pull/PullDatabaseCommandTest.php @@ -82,6 +82,14 @@ public function testPullDatabases(): void $this->assertStringContainsString('Downloading backup 1', $output); } + public function testPullDbHelp(): void + { + $help = $this->command->getHelp(); + $this->assertStringContainsString('This command requires authentication via the Cloud Platform API.', $help); + $this->assertStringContainsString('This command requires an active database connection. Set the following environment variables prior to running this command: ACLI_DB_HOST, ACLI_DB_NAME, ACLI_DB_USER, ACLI_DB_PASSWORD', $help); + $this->assertStringContainsString('This command requires the \'View database connection details\' permission.', $help); + } + public function testPullProdDatabase(): void { $localMachineHelper = $this->mockLocalMachineHelper(); From 68618f3cd4501dce25a156727029580feb7ba1bd Mon Sep 17 00:00:00 2001 From: Dane Powell Date: Wed, 16 Oct 2024 15:25:52 -0700 Subject: [PATCH 6/7] kill mutant --- .../src/Commands/Pull/PullCommandTestBase.php | 11 +++++++++-- .../Commands/Pull/PullDatabaseCommandTest.php | 16 ++++++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/tests/phpunit/src/Commands/Pull/PullCommandTestBase.php b/tests/phpunit/src/Commands/Pull/PullCommandTestBase.php index 5498eb3f3..d1371a639 100644 --- a/tests/phpunit/src/Commands/Pull/PullCommandTestBase.php +++ b/tests/phpunit/src/Commands/Pull/PullCommandTestBase.php @@ -351,10 +351,17 @@ protected function mockListSites(SshHelper|ObjectProphecy $sshHelper): void ->willReturn($process->reveal())->shouldBeCalled(); } - public function mockGetBackup(mixed $environment): void + public function mockGetBackup(mixed $environment, bool $perms = true): void { + if (!$perms) { + $tamper = static function ($databases): void { + $databases[0]->user_name = null; + }; + $this->mockRequest('getEnvironmentsDatabases', $environment->id, null, null, $tamper); + return; + } $databases = $this->mockRequest('getEnvironmentsDatabases', $environment->id); - $tamper = function ($backups): void { + $tamper = static function ($backups): void { $backups[0]->completedAt = $backups[0]->completed_at; }; $backups = new BackupsResponse( diff --git a/tests/phpunit/src/Commands/Pull/PullDatabaseCommandTest.php b/tests/phpunit/src/Commands/Pull/PullDatabaseCommandTest.php index b0f5e353a..a190cf0a7 100644 --- a/tests/phpunit/src/Commands/Pull/PullDatabaseCommandTest.php +++ b/tests/phpunit/src/Commands/Pull/PullDatabaseCommandTest.php @@ -310,6 +310,22 @@ public function testPullDatabaseWithMySqlImportError(): void ], self::inputChooseEnvironment()); } + public function testPullDatabaseWithMissingPermission(): void + { + $localMachineHelper = $this->mockLocalMachineHelper(); + $this->mockExecuteMySqlConnect($localMachineHelper, true); + $environment = $this->mockGetEnvironment(); + $sshHelper = $this->mockSshHelper(); + $this->mockListSites($sshHelper); + $this->mockGetBackup($environment, false); + + $this->expectException(AcquiaCliException::class); + $this->expectExceptionMessage('Database connection details missing'); + $this->executeCommand([ + '--no-scripts' => true, + ], self::inputChooseEnvironment()); + } + /** * @dataProvider providerTestPullDatabaseWithInvalidSslCertificate */ From 4bdb6471dceb18fd937ea62a16bbb623835d432a Mon Sep 17 00:00:00 2001 From: Dane Powell Date: Thu, 17 Oct 2024 14:41:45 -0700 Subject: [PATCH 7/7] allow pull:db --- src/Command/CommandBase.php | 6 ----- src/Command/Pull/PullCommandBase.php | 1 + src/Command/Pull/PullDatabaseCommand.php | 4 ++- src/Command/Push/PushDatabaseCommand.php | 6 +++++ .../src/Commands/Pull/PullCommandTestBase.php | 9 +------ .../Commands/Pull/PullDatabaseCommandTest.php | 24 ------------------ .../Commands/Push/PushDatabaseCommandTest.php | 25 +++++++++++++++++++ 7 files changed, 36 insertions(+), 39 deletions(-) diff --git a/src/Command/CommandBase.php b/src/Command/CommandBase.php index cf9d1dd09..6b4632a60 100644 --- a/src/Command/CommandBase.php +++ b/src/Command/CommandBase.php @@ -525,17 +525,11 @@ protected function getLocalFilesDir(string $site): string /** * @param string|null $site * @return DatabaseResponse[] - * @throws \Acquia\Cli\Exception\AcquiaCliException */ protected function determineCloudDatabases(Client $acquiaCloudClient, EnvironmentResponse $chosenEnvironment, string $site = null, bool $multipleDbs = false): array { $databasesRequest = new Databases($acquiaCloudClient); $databases = $databasesRequest->getAll($chosenEnvironment->uuid); - foreach ($databases as $database) { - if ($database->user_name === null) { - throw new AcquiaCliException('Database connection details missing'); - } - } if (count($databases) === 1) { $this->logger->debug('Only a single database detected on Cloud'); diff --git a/src/Command/Pull/PullCommandBase.php b/src/Command/Pull/PullCommandBase.php index 3d7a424ff..c1edd15cf 100644 --- a/src/Command/Pull/PullCommandBase.php +++ b/src/Command/Pull/PullCommandBase.php @@ -131,6 +131,7 @@ protected function pullCode(InputInterface $input, OutputInterface $output, bool /** * @param bool $onDemand Force on-demand backup. * @param bool $noImport Skip import. + * @throws \Acquia\Cli\Exception\AcquiaCliException */ protected function pullDatabase(InputInterface $input, OutputInterface $output, EnvironmentResponse $sourceEnvironment, bool $onDemand = false, bool $noImport = false, bool $multipleDbs = false): void { diff --git a/src/Command/Pull/PullDatabaseCommand.php b/src/Command/Pull/PullDatabaseCommand.php index ab0476e62..4cc916a14 100644 --- a/src/Command/Pull/PullDatabaseCommand.php +++ b/src/Command/Pull/PullDatabaseCommand.php @@ -15,7 +15,6 @@ #[RequireAuth] #[RequireLocalDb] -#[RequireRemoteDb] #[AsCommand(name: 'pull:database', description: 'Import database backup from a Cloud Platform environment', aliases: ['pull:db'])] final class PullDatabaseCommand extends PullCommandBase { @@ -51,6 +50,9 @@ protected function configure(): void ); } + /** + * @throws \Acquia\Cli\Exception\AcquiaCliException + */ protected function execute(InputInterface $input, OutputInterface $output): int { $noScripts = $input->hasOption('no-scripts') && $input->getOption('no-scripts'); diff --git a/src/Command/Push/PushDatabaseCommand.php b/src/Command/Push/PushDatabaseCommand.php index db2a60705..872715397 100644 --- a/src/Command/Push/PushDatabaseCommand.php +++ b/src/Command/Push/PushDatabaseCommand.php @@ -29,6 +29,9 @@ protected function configure(): void ->acceptSite(); } + /** + * @throws \Acquia\Cli\Exception\AcquiaCliException + */ protected function execute(InputInterface $input, OutputInterface $output): int { $destinationEnvironment = $this->determineEnvironment($input, $output); @@ -36,6 +39,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int $databases = $this->determineCloudDatabases($acquiaCloudClient, $destinationEnvironment, $input->getArgument('site')); // We only support pushing a single database. $database = $databases[0]; + if ($database->user_name === null) { + throw new AcquiaCliException('Database connection details missing'); + } $answer = $this->io->confirm("Overwrite the $database->name database on $destinationEnvironment->name with a copy of the database from the current machine?"); if (!$answer) { return Command::SUCCESS; diff --git a/tests/phpunit/src/Commands/Pull/PullCommandTestBase.php b/tests/phpunit/src/Commands/Pull/PullCommandTestBase.php index d1371a639..35804b82a 100644 --- a/tests/phpunit/src/Commands/Pull/PullCommandTestBase.php +++ b/tests/phpunit/src/Commands/Pull/PullCommandTestBase.php @@ -351,15 +351,8 @@ protected function mockListSites(SshHelper|ObjectProphecy $sshHelper): void ->willReturn($process->reveal())->shouldBeCalled(); } - public function mockGetBackup(mixed $environment, bool $perms = true): void + public function mockGetBackup(mixed $environment): void { - if (!$perms) { - $tamper = static function ($databases): void { - $databases[0]->user_name = null; - }; - $this->mockRequest('getEnvironmentsDatabases', $environment->id, null, null, $tamper); - return; - } $databases = $this->mockRequest('getEnvironmentsDatabases', $environment->id); $tamper = static function ($backups): void { $backups[0]->completedAt = $backups[0]->completed_at; diff --git a/tests/phpunit/src/Commands/Pull/PullDatabaseCommandTest.php b/tests/phpunit/src/Commands/Pull/PullDatabaseCommandTest.php index a190cf0a7..5fd11d7de 100644 --- a/tests/phpunit/src/Commands/Pull/PullDatabaseCommandTest.php +++ b/tests/phpunit/src/Commands/Pull/PullDatabaseCommandTest.php @@ -82,14 +82,6 @@ public function testPullDatabases(): void $this->assertStringContainsString('Downloading backup 1', $output); } - public function testPullDbHelp(): void - { - $help = $this->command->getHelp(); - $this->assertStringContainsString('This command requires authentication via the Cloud Platform API.', $help); - $this->assertStringContainsString('This command requires an active database connection. Set the following environment variables prior to running this command: ACLI_DB_HOST, ACLI_DB_NAME, ACLI_DB_USER, ACLI_DB_PASSWORD', $help); - $this->assertStringContainsString('This command requires the \'View database connection details\' permission.', $help); - } - public function testPullProdDatabase(): void { $localMachineHelper = $this->mockLocalMachineHelper(); @@ -310,22 +302,6 @@ public function testPullDatabaseWithMySqlImportError(): void ], self::inputChooseEnvironment()); } - public function testPullDatabaseWithMissingPermission(): void - { - $localMachineHelper = $this->mockLocalMachineHelper(); - $this->mockExecuteMySqlConnect($localMachineHelper, true); - $environment = $this->mockGetEnvironment(); - $sshHelper = $this->mockSshHelper(); - $this->mockListSites($sshHelper); - $this->mockGetBackup($environment, false); - - $this->expectException(AcquiaCliException::class); - $this->expectExceptionMessage('Database connection details missing'); - $this->executeCommand([ - '--no-scripts' => true, - ], self::inputChooseEnvironment()); - } - /** * @dataProvider providerTestPullDatabaseWithInvalidSslCertificate */ diff --git a/tests/phpunit/src/Commands/Push/PushDatabaseCommandTest.php b/tests/phpunit/src/Commands/Push/PushDatabaseCommandTest.php index 522431228..4bf198aa2 100644 --- a/tests/phpunit/src/Commands/Push/PushDatabaseCommandTest.php +++ b/tests/phpunit/src/Commands/Push/PushDatabaseCommandTest.php @@ -6,6 +6,7 @@ use Acquia\Cli\Command\CommandBase; use Acquia\Cli\Command\Push\PushDatabaseCommand; +use Acquia\Cli\Exception\AcquiaCliException; use Acquia\Cli\Helpers\LocalMachineHelper; use Acquia\Cli\Helpers\SshHelper; use Acquia\Cli\Tests\CommandTestBase; @@ -108,6 +109,30 @@ public function testPushDatabase(int $verbosity, bool $printOutput, bool $pv): v $this->assertStringContainsString('Overwrite the jxr136 database on dev with a copy of the database from the current machine?', $output); } + public function testPushDbHelp(): void + { + $help = $this->command->getHelp(); + $this->assertStringContainsString('This command requires authentication via the Cloud Platform API.', $help); + $this->assertStringContainsString('This command requires an active database connection. Set the following environment variables prior to running this command: ACLI_DB_HOST, ACLI_DB_NAME, ACLI_DB_USER, ACLI_DB_PASSWORD', $help); + $this->assertStringContainsString('This command requires the \'View database connection details\' permission.', $help); + } + + /** + * @throws \Exception + */ + public function testPushDatabaseWithMissingPermission(): void + { + $environment = $this->mockGetEnvironment(); + $tamper = static function ($databases): void { + $databases[0]->user_name = null; + }; + $this->mockRequest('getEnvironmentsDatabases', $environment->id, null, null, $tamper); + + $this->expectException(AcquiaCliException::class); + $this->expectExceptionMessage('Database connection details missing'); + $this->executeCommand([], self::inputChooseEnvironment()); + } + protected function mockUploadDatabaseDump( ObjectProphecy $localMachineHelper, ObjectProphecy $process,