Skip to content

Commit 9dcc63f

Browse files
committed
Write wp-config.php to repo root from start instead of ABSPATH and then moving up
1 parent 85a8dd5 commit 9dcc63f

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

tools/local-env/scripts/install.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const dotenv = require( 'dotenv' );
22
const dotenvExpand = require( 'dotenv-expand' );
33
const wait_on = require( 'wait-on' );
44
const { execSync } = require( 'child_process' );
5-
const { renameSync, readFileSync, writeFileSync } = require( 'fs' );
5+
const { readFileSync, writeFileSync } = require( 'fs' );
66
const local_env_utils = require( './utils' );
77

88
dotenvExpand.expand( dotenv.config() );
@@ -11,7 +11,7 @@ dotenvExpand.expand( dotenv.config() );
1111
local_env_utils.determine_auth_option();
1212

1313
// Create wp-config.php.
14-
wp_cli( 'config create --dbname=wordpress_develop --dbuser=root --dbpass=password --dbhost=mysql --force' );
14+
wp_cli( `config create --dbname=wordpress_develop --dbuser=root --dbpass=password --dbhost=mysql --force --config-file=${process.env.LOCAL_DIR}/../wp-config.php` );
1515

1616
// Add the debug settings to wp-config.php.
1717
// Windows requires this to be done as an additional step, rather than using the --extra-php option in the previous step.
@@ -22,9 +22,6 @@ wp_cli( `config set SCRIPT_DEBUG ${process.env.LOCAL_SCRIPT_DEBUG} --raw --type=
2222
wp_cli( `config set WP_ENVIRONMENT_TYPE ${process.env.LOCAL_WP_ENVIRONMENT_TYPE} --type=constant` );
2323
wp_cli( `config set WP_DEVELOPMENT_MODE ${process.env.LOCAL_WP_DEVELOPMENT_MODE} --type=constant` );
2424

25-
// Move wp-config.php to the base directory, so it doesn't get mixed up in the src or build directories.
26-
renameSync( `${process.env.LOCAL_DIR}/wp-config.php`, 'wp-config.php' );
27-
2825
// Read in wp-tests-config-sample.php, edit it to work with our config, then write it to wp-tests-config.php.
2926
const testConfig = readFileSync( 'wp-tests-config-sample.php', 'utf8' )
3027
.replace( 'youremptytestdbnamehere', 'wordpress_develop_tests' )

0 commit comments

Comments
 (0)