From 5ee2679283f6df48c5b659a8648a51b626e8a031 Mon Sep 17 00:00:00 2001 From: Phil Tyler Date: Tue, 17 Sep 2024 11:03:16 -0700 Subject: [PATCH 1/2] Don't require wp-config to be read-only for wp config has --- features/config-has.feature | 8 ++++++++ src/Config_Command.php | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/features/config-has.feature b/features/config-has.feature index 530c229a..c8a0ce74 100644 --- a/features/config-has.feature +++ b/features/config-has.feature @@ -15,6 +15,14 @@ Feature: Check whether the wp-config.php file or the wp-custom-config.php file h Then STDOUT should be empty And the return code should be 0 + Scenario: Check for the existance of an existing wp-config.php constant in a read-only file system + Given a WP install + + When I run `chmod -w wp-config.php` + And I try `wp config has DB_NAME` + Then STDOUT should be empty + And the return code should be 0 + @custom-config-file Scenario: Check the existence of an existing wp-custom-config.php constant or variable Given an empty directory diff --git a/src/Config_Command.php b/src/Config_Command.php index 35e39116..c266e134 100644 --- a/src/Config_Command.php +++ b/src/Config_Command.php @@ -818,7 +818,7 @@ public function has( $args, $assoc_args ) { $type = Utils\get_flag_value( $assoc_args, 'type' ); try { - $config_transformer = new WPConfigTransformer( $path ); + $config_transformer = new WPConfigTransformer( $path, true ); switch ( $type ) { case 'all': From 1d448c3ab7b4b14682722e3cec18abaed07609e9 Mon Sep 17 00:00:00 2001 From: Phil Tyler Date: Tue, 17 Sep 2024 12:12:12 -0700 Subject: [PATCH 2/2] upgrade wp-config-transformer dep --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index fd552c60..03235da0 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ ], "require": { "wp-cli/wp-cli": "^2.5", - "wp-cli/wp-config-transformer": "^1.2.1" + "wp-cli/wp-config-transformer": "^1.4.0" }, "require-dev": { "wp-cli/db-command": "^1.3 || ^2",