diff options
author | Jonathan Desrosiers <desrosj@git.wordpress.org> | 2024-10-22 23:44:25 +0000 |
---|---|---|
committer | Jonathan Desrosiers <desrosj@git.wordpress.org> | 2024-10-22 23:44:25 +0000 |
commit | 6f1423535a2f41c977649724b645083b2b88fdad (patch) | |
tree | c9d1fff6612ec40300734236f10e507fa8a9d55b /tools | |
parent | 170611ca0234d00a8739b109119867287d8e5fb9 (diff) | |
download | wordpress-6f1423535a2f41c977649724b645083b2b88fdad.tar.gz wordpress-6f1423535a2f41c977649724b645083b2b88fdad.zip |
Build/Test Tools: Revert [59277] to add a proper commit message.
Unprops desrosj.
git-svn-id: https://develop.svn.wordpress.org/trunk@59278 602fd350-edb4-49c9-b593-d223f7449a82
Diffstat (limited to 'tools')
-rw-r--r-- | tools/local-env/mysql-old-php.conf | 20 | ||||
-rw-r--r-- | tools/local-env/old-php-mysql-84.override.yml | 5 | ||||
-rw-r--r-- | tools/local-env/scripts/docker.js | 5 | ||||
-rw-r--r-- | tools/local-env/scripts/install.js | 14 | ||||
-rw-r--r-- | tools/local-env/scripts/start.js | 8 | ||||
-rw-r--r-- | tools/local-env/scripts/utils.js | 53 |
6 files changed, 5 insertions, 100 deletions
diff --git a/tools/local-env/mysql-old-php.conf b/tools/local-env/mysql-old-php.conf deleted file mode 100644 index ae1cb9b72a..0000000000 --- a/tools/local-env/mysql-old-php.conf +++ /dev/null @@ -1,20 +0,0 @@ -## -# The local Docker environment will try to use the database software's default authentication plugin whenever possible. -# -# One exception to this is using PHP 7.2 & 7.3 in combination with MySQL >= 8.0. These versions of PHP lack support for -# MySQL's caching_sha2_password plugin, which was made the new default in MySQL 8.0. -# -# Until MySQL 8.4, this could easily be changed using the --default-authentication-plugin with the old value of -# mysql_native_password. -# -# In MySQL 8.4, the --default-authentication-plugin option was removed in favor of --authentication-policy and -# mysql_native_password was disabled by default. -# -# When mounted to the database container in the local Docker environment, this file turns the old authentication plugin -# back on so that PHP 7.2 & 7.3 can be used in combination with MySQL 8.4. -# -# MySQL 9.0 will remove mysql_native_password. -## - -[mysqld] -mysql-native-password=ON diff --git a/tools/local-env/old-php-mysql-84.override.yml b/tools/local-env/old-php-mysql-84.override.yml deleted file mode 100644 index 3eca65f3c1..0000000000 --- a/tools/local-env/old-php-mysql-84.override.yml +++ /dev/null @@ -1,5 +0,0 @@ -services: - - mysql: - volumes: - - ./tools/local-env/mysql-old-php.conf:/etc/mysql/conf.d/config-file.cnf diff --git a/tools/local-env/scripts/docker.js b/tools/local-env/scripts/docker.js index 078ce89f91..b33fc2b3ed 100644 --- a/tools/local-env/scripts/docker.js +++ b/tools/local-env/scripts/docker.js @@ -1,11 +1,8 @@ const dotenv = require( 'dotenv' ); const dotenvExpand = require( 'dotenv-expand' ); const { execSync } = require( 'child_process' ); -const local_env_utils = require( './utils' ); dotenvExpand.expand( dotenv.config() ); -const composeFiles = local_env_utils.get_compose_files(); - // Execute any docker compose command passed to this script. -execSync( 'docker compose ' + composeFiles + ' ' + process.argv.slice( 2 ).join( ' ' ), { stdio: 'inherit' } ); +execSync( 'docker compose ' + process.argv.slice( 2 ).join( ' ' ), { stdio: 'inherit' } ); diff --git a/tools/local-env/scripts/install.js b/tools/local-env/scripts/install.js index 519fc37a0d..7bc2915fd4 100644 --- a/tools/local-env/scripts/install.js +++ b/tools/local-env/scripts/install.js @@ -3,14 +3,9 @@ const dotenvExpand = require( 'dotenv-expand' ); const wait_on = require( 'wait-on' ); const { execSync } = require( 'child_process' ); const { renameSync, readFileSync, writeFileSync } = require( 'fs' ); -const { utils } = require( './utils.js' ); -const local_env_utils = require( './utils' ); dotenvExpand.expand( dotenv.config() ); -// Determine if a non-default database authentication plugin needs to be used. -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' ); @@ -53,9 +48,7 @@ wait_on( { resources: [ `tcp:localhost:${process.env.LOCAL_PORT}`] } ) * @param {string} cmd The WP-CLI command to run. */ function wp_cli( cmd ) { - const composeFiles = local_env_utils.get_compose_files(); - - execSync( `docker compose ${composeFiles} run --rm cli ${cmd}`, { stdio: 'inherit' } ); + execSync( `docker compose run --rm cli ${cmd}`, { stdio: 'inherit' } ); } /** @@ -63,8 +56,7 @@ function wp_cli( cmd ) { */ function install_wp_importer() { const testPluginDirectory = 'tests/phpunit/data/plugins/wordpress-importer'; - const composeFiles = local_env_utils.get_compose_files(); - execSync( `docker compose ${composeFiles} exec -T php rm -rf ${testPluginDirectory}`, { stdio: 'inherit' } ); - execSync( `docker compose ${composeFiles} exec -T php git clone https://github.com/WordPress/wordpress-importer.git ${testPluginDirectory} --depth=1`, { stdio: 'inherit' } ); + execSync( `docker compose exec -T php rm -rf ${testPluginDirectory}`, { stdio: 'inherit' } ); + execSync( `docker compose exec -T php git clone https://github.com/WordPress/wordpress-importer.git ${testPluginDirectory} --depth=1`, { stdio: 'inherit' } ); } diff --git a/tools/local-env/scripts/start.js b/tools/local-env/scripts/start.js index ef7fb7b7d4..92fa360149 100644 --- a/tools/local-env/scripts/start.js +++ b/tools/local-env/scripts/start.js @@ -1,7 +1,6 @@ const dotenv = require( 'dotenv' ); const dotenvExpand = require( 'dotenv-expand' ); const { execSync } = require( 'child_process' ); -const local_env_utils = require( './utils' ); const { constants, copyFile } = require( 'node:fs' ); // Copy the default .env file when one is not present. @@ -11,11 +10,6 @@ copyFile( '.env.example', '.env', constants.COPYFILE_EXCL, (e) => { dotenvExpand.expand( dotenv.config() ); -const composeFiles = local_env_utils.get_compose_files(); - -// Determine if a non-default database authentication plugin needs to be used. -local_env_utils.determine_auth_option(); - // Check if the Docker service is running. try { execSync( 'docker info' ); @@ -31,7 +25,7 @@ try { const containers = ( process.env.LOCAL_PHP_MEMCACHED === 'true' ) ? 'wordpress-develop memcached' : 'wordpress-develop'; -execSync( `docker compose ${composeFiles} up -d ${containers}`, { stdio: 'inherit' } ); +execSync( `docker compose up -d ${containers}`, { stdio: 'inherit' } ); // If Docker Toolbox is being used, we need to manually forward LOCAL_PORT to the Docker VM. if ( process.env.DOCKER_TOOLBOX_INSTALL_PATH ) { diff --git a/tools/local-env/scripts/utils.js b/tools/local-env/scripts/utils.js deleted file mode 100644 index 88243b3413..0000000000 --- a/tools/local-env/scripts/utils.js +++ /dev/null @@ -1,53 +0,0 @@ -const local_env_utils = { - - /** - * Determines which Docker compose files are required to properly configure the local environment given the - * specified PHP version, database type, and database version. - * - * By default, only the standard docker-compose.yml file will be used. - * - * When PHP 7.2 or 7.3 is used in combination with MySQL 8.4, an override file will also be returned to ensure - * that the mysql_native_password plugin authentication plugin is on and available for use. - */ - get_compose_files: function() { - var composeFiles = '-f docker-compose.yml'; - - if ( process.env.LOCAL_DB_TYPE !== 'mysql' ) { - return composeFiles; - } - - if ( process.env.LOCAL_PHP !== '7.2-fpm' && process.env.LOCAL_PHP !== '7.3-fpm' ) { - return composeFiles; - } - - // PHP 7.2/7.3 in combination with MySQL 8.4 requires additional configuration to function properly. - if ( process.env.LOCAL_DB_VERSION === '8.4' ) { - composeFiles = composeFiles + ' -f tools/local-env/old-php-mysql-84.override.yml'; - } - - return composeFiles; - }, - - /** - * Determines the option to pass for proper authentication plugin configuration given the specified PHP version, - * database type, and database version. - */ - determine_auth_option: function() { - if ( process.env.LOCAL_DB_TYPE !== 'mysql' ) { - return; - } - - if ( process.env.LOCAL_PHP !== '7.2-fpm' && process.env.LOCAL_PHP !== '7.3-fpm' ) { - return; - } - - // MySQL 8.4 removed --default-authentication-plugin in favor of --authentication-policy. - if ( process.env.LOCAL_DB_VERSION === '8.4' ) { - process.env.LOCAL_DB_AUTH_OPTION = '--authentication-policy=mysql_native_password'; - } else { - process.env.LOCAL_DB_AUTH_OPTION = '--default-authentication-plugin=mysql_native_password'; - } - } -}; - -module.exports = local_env_utils; |