Skip to content

Commit 4c385fd

Browse files
authored
Merge pull request #187 from pwtyler/config-has-184
Don't require file to be writable for config has
2 parents 581bdbb + 1d448c3 commit 4c385fd

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
],
1919
"require": {
2020
"wp-cli/wp-cli": "^2.5",
21-
"wp-cli/wp-config-transformer": "^1.2.1"
21+
"wp-cli/wp-config-transformer": "^1.4.0"
2222
},
2323
"require-dev": {
2424
"wp-cli/db-command": "^1.3 || ^2",

features/config-has.feature

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@ Feature: Check whether the wp-config.php file or the wp-custom-config.php file h
1515
Then STDOUT should be empty
1616
And the return code should be 0
1717

18+
Scenario: Check for the existance of an existing wp-config.php constant in a read-only file system
19+
Given a WP install
20+
21+
When I run `chmod -w wp-config.php`
22+
And I try `wp config has DB_NAME`
23+
Then STDOUT should be empty
24+
And the return code should be 0
25+
1826
@custom-config-file
1927
Scenario: Check the existence of an existing wp-custom-config.php constant or variable
2028
Given an empty directory

src/Config_Command.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -818,7 +818,7 @@ public function has( $args, $assoc_args ) {
818818
$type = Utils\get_flag_value( $assoc_args, 'type' );
819819

820820
try {
821-
$config_transformer = new WPConfigTransformer( $path );
821+
$config_transformer = new WPConfigTransformer( $path, true );
822822

823823
switch ( $type ) {
824824
case 'all':

0 commit comments

Comments
 (0)