diff --git a/.env b/.env index b673e401c2eaf..70cd4153b3757 100644 --- a/.env +++ b/.env @@ -53,6 +53,9 @@ LOCAL_DB_TYPE=mysql ## LOCAL_DB_VERSION=8.0 +# Whether or not to enable multisite. +LOCAL_MULTISITE=false + # The debug settings to add to `wp-config.php`. LOCAL_WP_DEBUG=true LOCAL_WP_DEBUG_LOG=true @@ -60,6 +63,7 @@ LOCAL_WP_DEBUG_DISPLAY=true LOCAL_SCRIPT_DEBUG=true LOCAL_WP_ENVIRONMENT_TYPE=local LOCAL_WP_DEVELOPMENT_MODE=core +LOCAL_WP_TESTS_DOMAIN=example.org # The URL to use when running e2e tests. WP_BASE_URL=http://localhost:${LOCAL_PORT} diff --git a/.github/workflows/phpunit-tests-run.yml b/.github/workflows/phpunit-tests-run.yml index 68f9d003a4fcf..9978fd9bf70fb 100644 --- a/.github/workflows/phpunit-tests-run.yml +++ b/.github/workflows/phpunit-tests-run.yml @@ -40,6 +40,11 @@ on: required: false type: 'string' default: 'phpunit.xml.dist' + tests-domain: + description: 'The domain to use for the tests' + required: false + type: 'string' + default: 'example.org' report: description: 'Whether to report results to WordPress.org Hosting Tests' required: false @@ -50,6 +55,7 @@ env: LOCAL_DB_TYPE: ${{ inputs.db-type }} LOCAL_DB_VERSION: ${{ inputs.db-version }} LOCAL_PHP_MEMCACHED: ${{ inputs.memcached }} + LOCAL_WP_TESTS_DOMAIN: ${{ inputs.tests-domain }} PHPUNIT_CONFIG: ${{ inputs.phpunit-config }} PUPPETEER_SKIP_DOWNLOAD: ${{ true }} @@ -74,7 +80,7 @@ jobs: # - Checks out the WordPress Test reporter repository. # - Submit the test results to the WordPress.org host test results. phpunit-tests: - name: PHP ${{ inputs.php }} / ${{ 'mariadb' == inputs.db-type && 'MariaDB' || 'MySQL' }} ${{ inputs.db-version }}${{ inputs.multisite && ' multisite' || '' }}${{ inputs.memcached && ' with memcached' || '' }}${{ inputs.report && ' (test reporting enabled)' || '' }} + name: PHP ${{ inputs.php }} / ${{ 'mariadb' == inputs.db-type && 'MariaDB' || 'MySQL' }} ${{ inputs.db-version }}${{ inputs.multisite && ' multisite' || '' }}${{ inputs.memcached && ' with memcached' || '' }}${{ inputs.report && ' (test reporting enabled)' || '' }} ${{ 'example.org' != inputs.tests-domain && inputs.tests-domain || '' }} runs-on: ${{ inputs.os }} timeout-minutes: 20 diff --git a/.github/workflows/phpunit-tests.yml b/.github/workflows/phpunit-tests.yml index 5cbd87631505e..3bc72f8e8c528 100644 --- a/.github/workflows/phpunit-tests.yml +++ b/.github/workflows/phpunit-tests.yml @@ -48,6 +48,7 @@ jobs: php: [ '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3' ] db-type: [ 'mysql' ] db-version: [ '5.7', '8.0', '8.1', '8.2', '8.3' ] + tests-domain: [ 'example.org' ] multisite: [ false, true ] memcached: [ false ] @@ -57,19 +58,37 @@ jobs: php: '7.4' db-type: 'mysql' db-version: '5.7' + tests-domain: 'example.org' multisite: false memcached: true - os: ubuntu-latest php: '7.4' db-type: 'mysql' db-version: '5.7' + tests-domain: 'example.org' multisite: true memcached: true + # Include jobs with a port on the test domain for both single and multisite. + - os: ubuntu-latest + php: '7.4' + db-type: 'mysql' + db-version: '5.7' + tests-domain: 'example.org:8889' + multisite: false + memcached: false + - os: ubuntu-latest + php: '7.4' + db-type: 'mysql' + db-version: '5.7' + tests-domain: 'example.org:8889' + multisite: true + memcached: false # Report test results to the Host Test Results. - os: ubuntu-latest php: '7.4' db-type: 'mysql' db-version: '5.7' + tests-domain: 'example.org' multisite: false memcached: false report: true @@ -81,6 +100,7 @@ jobs: multisite: ${{ matrix.multisite }} memcached: ${{ matrix.memcached }} phpunit-config: ${{ matrix.multisite && 'tests/phpunit/multisite.xml' || 'phpunit.xml.dist' }} + tests-domain: ${{ matrix.tests-domain }} report: ${{ matrix.report || false }} # diff --git a/src/wp-admin/includes/network.php b/src/wp-admin/includes/network.php index 67a9e0289e56b..9577172a803ba 100644 --- a/src/wp-admin/includes/network.php +++ b/src/wp-admin/includes/network.php @@ -148,26 +148,8 @@ function network_step1( $errors = false ) { die(); } - $hostname = get_clean_basedomain(); - $has_ports = strstr( $hostname, ':' ); - if ( ( false !== $has_ports && ! in_array( $has_ports, array( ':80', ':443' ), true ) ) ) { - wp_admin_notice( - '' . __( 'Error:' ) . ' ' . __( 'You cannot install a network of sites with your server address.' ), - array( - 'additional_classes' => array( 'error' ), - ) - ); - - echo '
' . sprintf(
- /* translators: %s: Port number. */
- __( 'You cannot use port numbers such as %s.' ),
- '' . $has_ports . '
'
- ) . '