Skip to content

Commit

Permalink
Build/Test Tools: Fix the source code path handling when installing t…
Browse files Browse the repository at this point in the history
…he local development environment.

This ensures the correct code is used to run the installation depending on whether it should be running from the `src` or `build` directory.

Props swissspidy, johnbillion

See #62221

git-svn-id: https://develop.svn.wordpress.org/trunk@59752 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
johnbillion committed Feb 3, 2025
1 parent bcdca3f commit 3ff586a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tools/local-env/scripts/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ dotenvExpand.expand( dotenv.config() );
local_env_utils.determine_auth_option();

// Create wp-config.php.
wp_cli( 'config create --dbname=wordpress_develop --dbuser=root --dbpass=password --dbhost=mysql --path=/var/www/src --force' );
wp_cli( 'config create --dbname=wordpress_develop --dbuser=root --dbpass=password --dbhost=mysql --force' );

// Add the debug settings to wp-config.php.
// Windows requires this to be done as an additional step, rather than using the --extra-php option in the previous step.
Expand All @@ -24,7 +24,7 @@ wp_cli( `config set WP_ENVIRONMENT_TYPE ${process.env.LOCAL_WP_ENVIRONMENT_TYPE}
wp_cli( `config set WP_DEVELOPMENT_MODE ${process.env.LOCAL_WP_DEVELOPMENT_MODE} --type=constant` );

// Move wp-config.php to the base directory, so it doesn't get mixed up in the src or build directories.
renameSync( 'src/wp-config.php', 'wp-config.php' );
renameSync( `${process.env.LOCAL_DIR}/wp-config.php`, 'wp-config.php' );

install_wp_importer();

Expand Down Expand Up @@ -55,7 +55,7 @@ wait_on( { resources: [ `tcp:localhost:${process.env.LOCAL_PORT}`] } )
function wp_cli( cmd ) {
const composeFiles = local_env_utils.get_compose_files();

execSync( `docker compose ${composeFiles} run --quiet-pull --rm cli ${cmd}`, { stdio: 'inherit' } );
execSync( `docker compose ${composeFiles} run --quiet-pull --rm cli ${cmd} --path=/var/www/${process.env.LOCAL_DIR}`, { stdio: 'inherit' } );
}

/**
Expand Down

0 comments on commit 3ff586a

Please sign in to comment.