Changeset 60305
- Timestamp:
- 06/12/2025 09:00:24 PM (7 months ago)
- Location:
- trunk
- Files:
-
- 2 edited
-
docker-compose.yml (modified) (1 diff)
-
tools/local-env/scripts/install.js (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/docker-compose.yml
r59679 r60305 107 107 PHP_FPM_GID: ${PHP_FPM_GID-1000} 108 108 HOST_PATH: ${PWD-}/${LOCAL_DIR-src} 109 WP_CONFIG_PATH: /var/www/wp-config.php 109 110 110 111 volumes: -
trunk/tools/local-env/scripts/install.js
r60287 r60305 1 /* jshint node:true */ 2 1 3 const dotenv = require( 'dotenv' ); 2 4 const dotenvExpand = require( 'dotenv-expand' ); 3 5 const wait_on = require( 'wait-on' ); 4 6 const { execSync } = require( 'child_process' ); 5 const { re nameSync, readFileSync, writeFileSync } = require( 'fs' );7 const { readFileSync, writeFileSync } = require( 'fs' ); 6 8 const local_env_utils = require( './utils' ); 7 9 … … 12 14 13 15 // Create wp-config.php. 14 wp_cli( 'config create --dbname=wordpress_develop --dbuser=root --dbpass=password --dbhost=mysql --force');16 wp_cli( `config create --dbname=wordpress_develop --dbuser=root --dbpass=password --dbhost=mysql --force --config-file=${process.env.LOCAL_DIR}/../wp-config.php` ); 15 17 16 18 // Add the debug settings to wp-config.php. … … 23 25 wp_cli( `config set WP_DEVELOPMENT_MODE ${process.env.LOCAL_WP_DEVELOPMENT_MODE} --type=constant` ); 24 26 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 28 27 // Read in wp-tests-config-sample.php, edit it to work with our config, then write it to wp-tests-config.php. 29 28 const testConfig = readFileSync( 'wp-tests-config-sample.php', 'utf8' ) … … 32 31 .replace( 'yourpasswordhere', 'password' ) 33 32 .replace( 'localhost', 'mysql' ) 34 .replace( "'WP_TESTS_DOMAIN', 'example.org'", `'WP_TESTS_DOMAIN', '${process.env.LOCAL_WP_TESTS_DOMAIN}'` )35 .concat( "\ndefine( 'FS_METHOD', 'direct' );\n");33 .replace( `'WP_TESTS_DOMAIN', 'example.org'`, `'WP_TESTS_DOMAIN', '${process.env.LOCAL_WP_TESTS_DOMAIN}'` ) 34 .concat( `\ndefine( 'FS_METHOD', 'direct' );\n` ); 36 35 37 36 writeFileSync( 'wp-tests-config.php', testConfig ); 38 37 39 38 // Once the site is available, install WordPress! 40 wait_on( { resources: [ `tcp:localhost:${process.env.LOCAL_PORT}`] } ) 39 wait_on( { 40 resources: [ `tcp:localhost:${process.env.LOCAL_PORT}`], 41 timeout: 3000, 42 } ) 43 .catch( err => { 44 console.error( `Error: It appears the development environment has not been started. Message: ${ err.message }` ); 45 console.error( `Did you forget to do 'npm run env:start'?` ); 46 process.exit( 1 ); 47 } ) 41 48 .then( () => { 42 49 wp_cli( 'db reset --yes' ); 43 50 const installCommand = process.env.LOCAL_MULTISITE === 'true' ? 'multisite-install' : 'install'; 44 51 wp_cli( `core ${ installCommand } --title="WordPress Develop" --admin_user=admin --admin_password=password --admin_email=test@example.com --skip-email --url=http://localhost:${process.env.LOCAL_PORT}` ); 52 } ) 53 .catch( err => { 54 console.error( `Error: Unable to reset DB and install WordPress. Message: ${ err.message }` ); 55 process.exit( 1 ); 45 56 } ); 46 57
Note: See TracChangeset
for help on using the changeset viewer.