Make WordPress Core

Changeset 59309


Ignore:
Timestamp:
10/28/2024 05:36:17 PM (3 months ago)
Author:
desrosj
Message:

Build/Test Tools: Add MySQL 8.4 support to the Docker environment.

Because caching_sha2_password is not supported on PHP 7.2 & 7.3, the local Docker environment has used the --default-authentication-plugin system variable to always make use of mysql_native_password despite MySQL 8.0 deprecating this auth plugin.

However in MySQL 8.4, the --default-authentication-plugin option was removed in favor of --authentication-policy, and mysql_native_password is now disabled by default. mysql_native_password has also been removed in MySQL 9.0.

This change adds support to the local Docker environment for MySQL 8.4 by adding some helper functions that determine which authentication plugin should be used based on the configured PHP/MySQL versions and automatically making the necessary configuration adjustments.

Reviewed by peterwilsoncc.
Merges [59279] to the 6.7 branch.

Props ayeshrajans, johnbillion, aristath, jorbin.
See #61218.

Location:
branches/6.7
Files:
5 edited
3 copied

Legend:

Unmodified
Added
Removed
  • branches/6.7

  • branches/6.7/docker-compose.yml

    r58157 r59309  
    8080
    8181    # For compatibility with PHP versions that don't support the caching_sha2_password auth plugin used in MySQL 8.0.
    82     command: --default-authentication-plugin=mysql_native_password
     82    command: ${LOCAL_DB_AUTH_OPTION-}
    8383
    8484    healthcheck:
  • branches/6.7/tools/local-env/scripts/docker.js

    r57918 r59309  
    22const dotenvExpand = require( 'dotenv-expand' );
    33const { execSync } = require( 'child_process' );
     4const local_env_utils = require( './utils' );
    45
    56dotenvExpand.expand( dotenv.config() );
    67
     8const composeFiles = local_env_utils.get_compose_files();
     9
    710// Execute any docker compose command passed to this script.
    8 execSync( 'docker compose ' + process.argv.slice( 2 ).join( ' ' ), { stdio: 'inherit' } );
     11execSync( 'docker compose ' + composeFiles + ' ' + process.argv.slice( 2 ).join( ' ' ), { stdio: 'inherit' } );
  • branches/6.7/tools/local-env/scripts/install.js

    r58097 r59309  
    44const { execSync } = require( 'child_process' );
    55const { renameSync, readFileSync, writeFileSync } = require( 'fs' );
     6const { utils } = require( './utils.js' );
     7const local_env_utils = require( './utils' );
    68
    79dotenvExpand.expand( dotenv.config() );
     10
     11// Determine if a non-default database authentication plugin needs to be used.
     12local_env_utils.determine_auth_option();
    813
    914// Create wp-config.php.
     
    4954 */
    5055function wp_cli( cmd ) {
    51     execSync( `docker compose run --rm cli ${cmd}`, { stdio: 'inherit' } );
     56    const composeFiles = local_env_utils.get_compose_files();
     57
     58    execSync( `docker compose ${composeFiles} run --rm cli ${cmd}`, { stdio: 'inherit' } );
    5259}
    5360
     
    5764function install_wp_importer() {
    5865    const testPluginDirectory = 'tests/phpunit/data/plugins/wordpress-importer';
     66    const composeFiles = local_env_utils.get_compose_files();
    5967
    60     execSync( `docker compose exec -T php rm -rf ${testPluginDirectory}`, { stdio: 'inherit' } );
    61     execSync( `docker compose exec -T php git clone https://github.com/WordPress/wordpress-importer.git ${testPluginDirectory} --depth=1`, { stdio: 'inherit' } );
     68    execSync( `docker compose ${composeFiles} exec -T php rm -rf ${testPluginDirectory}`, { stdio: 'inherit' } );
     69    execSync( `docker compose ${composeFiles} exec -T php git clone https://github.com/WordPress/wordpress-importer.git ${testPluginDirectory} --depth=1`, { stdio: 'inherit' } );
    6270}
  • branches/6.7/tools/local-env/scripts/start.js

    r59249 r59309  
    22const dotenvExpand = require( 'dotenv-expand' );
    33const { execSync } = require( 'child_process' );
     4const local_env_utils = require( './utils' );
    45const { constants, copyFile } = require( 'node:fs' );
    56
     
    1011
    1112dotenvExpand.expand( dotenv.config() );
     13
     14const composeFiles = local_env_utils.get_compose_files();
     15
     16// Determine if a non-default database authentication plugin needs to be used.
     17local_env_utils.determine_auth_option();
    1218
    1319// Check if the Docker service is running.
     
    2632    ? 'wordpress-develop memcached'
    2733    : 'wordpress-develop';
    28 execSync( `docker compose up -d ${containers}`, { stdio: 'inherit' } );
     34execSync( `docker compose ${composeFiles} up -d ${containers}`, { stdio: 'inherit' } );
    2935
    3036// If Docker Toolbox is being used, we need to manually forward LOCAL_PORT to the Docker VM.
Note: See TracChangeset for help on using the changeset viewer.