diff --git a/.github/workflows/install-testing.yml b/.github/workflows/install-testing.yml index 981d2a18fb148..61bbdeecc0cf7 100644 --- a/.github/workflows/install-testing.yml +++ b/.github/workflows/install-testing.yml @@ -47,7 +47,7 @@ jobs: permissions: contents: read secrets: inherit - if: ${{ github.repository == 'WordPress/wordpress-develop' || ( github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' ) }} + if: ${{ github.repository == 'WordPress/wordpress-develop' }} with: wp-version: ${{ inputs.wp-version }} @@ -63,7 +63,7 @@ jobs: permissions: contents: read runs-on: ${{ matrix.os }} - if: ${{ github.repository == 'WordPress/wordpress-develop' || ( github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' ) }} + if: ${{ github.repository == 'WordPress/wordpress-develop' }} timeout-minutes: 10 needs: [ build-test-matrix ] strategy: diff --git a/.github/workflows/local-docker-environment.yml b/.github/workflows/local-docker-environment.yml index b94c5bb8e5dad..c0a70c9afb7df 100644 --- a/.github/workflows/local-docker-environment.yml +++ b/.github/workflows/local-docker-environment.yml @@ -73,7 +73,7 @@ jobs: permissions: contents: read secrets: inherit - if: ${{ github.repository == 'WordPress/wordpress-develop' || ( github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' ) }} + if: ${{ github.repository == 'WordPress/wordpress-develop' }} with: wp-version: ${{ github.event_name == 'pull_request' && github.base_ref || github.ref_name }} diff --git a/.github/workflows/phpunit-tests.yml b/.github/workflows/phpunit-tests.yml index 3c55528cd13aa..cfc331cedc04b 100644 --- a/.github/workflows/phpunit-tests.yml +++ b/.github/workflows/phpunit-tests.yml @@ -63,7 +63,7 @@ jobs: permissions: contents: read secrets: inherit - if: ${{ github.repository == 'WordPress/wordpress-develop' || ( github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' ) }} + if: ${{ startsWith( github.repository, 'WordPress/' ) && ( github.repository == 'WordPress/wordpress-develop' || ( github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' ) ) }} strategy: fail-fast: false matrix: @@ -140,7 +140,7 @@ jobs: permissions: contents: read secrets: inherit - if: ${{ github.repository == 'WordPress/wordpress-develop' || ( github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' ) }} + if: ${{ startsWith( github.repository, 'WordPress/' ) && ( github.repository == 'WordPress/wordpress-develop' || ( github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' ) ) }} strategy: fail-fast: false matrix: @@ -192,7 +192,7 @@ jobs: permissions: contents: read secrets: inherit - if: ${{ github.repository == 'WordPress/wordpress-develop' || ( github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' ) }} + if: ${{ startsWith( github.repository, 'WordPress/' ) && ( github.repository == 'WordPress/wordpress-develop' || ( github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' ) ) }} strategy: fail-fast: false matrix: @@ -232,7 +232,7 @@ jobs: permissions: contents: read secrets: inherit - if: ${{ github.repository == 'WordPress/wordpress-develop' || ( github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' ) }} + if: ${{ startsWith( github.repository, 'WordPress/' ) && ( github.repository == 'WordPress/wordpress-develop' || ( github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' ) ) }} strategy: fail-fast: false matrix: @@ -246,13 +246,71 @@ jobs: db-version: ${{ matrix.db-version }} phpunit-test-groups: ${{ matrix.phpunit-test-groups }} + # + # Runs unit tests for forks. + # + # Because the majority of forks will belong to personal GitHub accounts (which are limited to just 20 concurrent jobs + # at any given time), forks only run a small subset of test combinations. This allows contributors to open pull + # requests back to their own forks for testing purposes without having to wait hours for workflow to complete. + # + limited-matrix-for-forks: + name: PHP ${{ matrix.php }} + uses: ./.github/workflows/reusable-phpunit-tests-v3.yml + permissions: + contents: read + secrets: inherit + if: ${{ ! startsWith( github.repository, 'WordPress/' ) && github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' }} + strategy: + fail-fast: false + matrix: + php: [ '7.2', '8.4' ] + db-version: [ '8.4', '11.8' ] + db-type: [ 'mysql', 'mariadb' ] + multisite: [ false ] + + include: + # Include one multisite job for each database type. + - php: '8.4' + db-version: '8.4' + db-type: 'mysql' + multisite: true + - php: '8.4' + db-version: '11.8' + db-type: 'mariadb' + multisite: true + # Test with memcached. + - php: '8.4' + db-version: '8.4' + db-type: 'mysql' + multisite: true + memcached: true + # Run specific test groups once. + - php: '8.4' + db-version: '8.4' + db-type: 'mysql' + phpunit-test-groups: 'html-api-html5lib-tests' + + exclude: + # Exclude PHP versions that are not supported by the database versions. + - db-type: 'mysql' + db-version: '11.8' + - db-type: 'mariadb' + db-version: '8.4' + + with: + php: ${{ matrix.php }} + db-version: ${{ matrix.db-version }} + db-type: ${{ matrix.db-type }} + memcached: ${{ matrix.memcached || false }} + phpunit-test-groups: ${{ matrix.phpunit-test-groups || '' }} + slack-notifications: name: Slack Notifications uses: ./.github/workflows/slack-notifications.yml permissions: actions: read contents: read - needs: [ test-with-mysql, test-with-mariadb, test-innovation-releases, specific-test-groups ] + needs: [ test-with-mysql, test-with-mariadb, test-innovation-releases, specific-test-groups, limited-matrix-for-forks ] if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }} with: calling_status: ${{ contains( needs.*.result, 'cancelled' ) && 'cancelled' || contains( needs.*.result, 'failure' ) && 'failure' || 'success' }} diff --git a/.github/workflows/test-and-zip-default-themes.yml b/.github/workflows/test-and-zip-default-themes.yml index 49b7522cfe1a7..56cc2e9895cd2 100644 --- a/.github/workflows/test-and-zip-default-themes.yml +++ b/.github/workflows/test-and-zip-default-themes.yml @@ -189,7 +189,7 @@ jobs: contents: read needs: [ check-for-empty-files, test-build-scripts ] timeout-minutes: 10 - if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} + if: ${{ github.repository == 'WordPress/wordpress-develop' }} strategy: fail-fast: false matrix: diff --git a/.github/workflows/test-build-processes.yml b/.github/workflows/test-build-processes.yml index 966a458550dc3..559dd0a92a1c4 100644 --- a/.github/workflows/test-build-processes.yml +++ b/.github/workflows/test-build-processes.yml @@ -45,7 +45,7 @@ concurrency: permissions: {} jobs: - # Tests the WordPress Core build process on multiple operating systems. + # Tests the WordPress Core build process. test-core-build-process: name: Core running from ${{ matrix.directory }} uses: ./.github/workflows/reusable-test-core-build-process.yml @@ -55,30 +55,31 @@ jobs: strategy: fail-fast: false matrix: - os: [ ubuntu-24.04, windows-2022 ] + os: [ 'ubuntu-24.04' ] directory: [ 'src', 'build' ] include: # Only prepare artifacts for Playground once. - - os: ubuntu-24.04 + - os: 'ubuntu-24.04' directory: 'build' save-build: true prepare-playground: ${{ github.event_name == 'pull_request' && true || '' }} - with: os: ${{ matrix.os }} directory: ${{ matrix.directory }} save-build: ${{ matrix.save-build && matrix.save-build || false }} prepare-playground: ${{ matrix.prepare-playground && matrix.prepare-playground || false }} - # Tests the WordPress Core build process on MacOS. + # Tests the WordPress Core build process on additional operating systems. # - # This is separate from the job above in order to use stricter conditions when determining when to run. - # This avoids unintentionally consuming excessive minutes, as MacOS jobs consume minutes at a 10x rate. + # This is separate from the job above in order to use stricter conditions when determining when to test additional + # operating systems. This avoids unintentionally consuming excessive minutes. Windows-based jobs consume minutes at a + # 2x rate, and MacOS-based jobs at a 10x rate. + # See https://docs.github.com/en/billing/concepts/product-billing/github-actions#per-minute-rates. # # The `matrix` and `runner` contexts are not available for use within `if` expressions. So there is # currently no way to determine the OS being used on a given job. # See https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability. - test-core-build-process-macos: + test-core-build-process-additional-os: name: Core running from ${{ matrix.directory }} uses: ./.github/workflows/reusable-test-core-build-process.yml permissions: @@ -87,37 +88,39 @@ jobs: strategy: fail-fast: false matrix: - os: [ macos-14 ] + os: [ 'macos-14', 'windows-2022' ] directory: [ 'src', 'build' ] with: os: ${{ matrix.os }} directory: ${{ matrix.directory }} - # Tests the Gutenberg plugin build process on multiple operating systems when run within a wordpress-develop checkout. + # Tests the Gutenberg plugin build process within a wordpress-develop checkout. test-gutenberg-build-process: name: Gutenberg running from ${{ matrix.directory }} uses: ./.github/workflows/reusable-test-gutenberg-build-process.yml permissions: contents: read - if: ${{ github.repository == 'WordPress/wordpress-develop' || ( github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' ) }} + if: ${{ github.repository == 'WordPress/wordpress-develop' }} strategy: fail-fast: false matrix: - os: [ ubuntu-24.04, windows-2022 ] + os: [ 'ubuntu-24.04' ] directory: [ 'src', 'build' ] with: os: ${{ matrix.os }} directory: ${{ matrix.directory }} - # Tests the Gutenberg plugin build process on MacOS when run within a wordpress-develop checkout. + # Tests the Gutenberg plugin build process on additional operating systems. # - # This is separate from the job above in order to use stricter conditions when determining when to run. - # This avoids unintentionally consuming excessive minutes, as MacOS jobs consume minutes at a 10x rate. + # This is separate from the job above in order to use stricter conditions when determining when to test additional + # operating systems. This avoids unintentionally consuming excessive minutes. Windows-based jobs consume minutes at a + # 2x rate, and MacOS-based jobs at a 10x rate. + # See https://docs.github.com/en/billing/concepts/product-billing/github-actions#per-minute-rates. # # The `matrix` and `runner` contexts are not available for use within `if` expressions. So there is # currently no way to determine the OS being used on a given job. # See https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability. - test-gutenberg-build-process-macos: + test-gutenberg-build-process-additional-os: name: Gutenberg running from ${{ matrix.directory }} uses: ./.github/workflows/reusable-test-gutenberg-build-process.yml permissions: @@ -126,7 +129,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ macos-14 ] + os: [ 'macos-14', 'windows-2022' ] directory: [ 'src', 'build' ] with: os: ${{ matrix.os }} @@ -138,7 +141,7 @@ jobs: permissions: actions: read contents: read - needs: [ test-core-build-process, test-core-build-process-macos, test-gutenberg-build-process, test-gutenberg-build-process-macos ] + needs: [ test-core-build-process, test-core-build-process-additional-os, test-gutenberg-build-process, test-gutenberg-build-process-additional-os ] if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }} with: calling_status: ${{ contains( needs.*.result, 'cancelled' ) && 'cancelled' || contains( needs.*.result, 'failure' ) && 'failure' || 'success' }} diff --git a/.github/workflows/upgrade-develop-testing.yml b/.github/workflows/upgrade-develop-testing.yml index b24fd5fea220d..ad5211f271f4d 100644 --- a/.github/workflows/upgrade-develop-testing.yml +++ b/.github/workflows/upgrade-develop-testing.yml @@ -47,6 +47,7 @@ jobs: build: name: Build uses: ./.github/workflows/reusable-build-package.yml + if: ${{ startsWith( github.repository, 'WordPress/' ) && ( github.repository == 'WordPress/wordpress-develop' || ( github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' ) ) }} permissions: contents: read @@ -54,7 +55,7 @@ jobs: upgrade-tests-develop: name: Upgrade from ${{ matrix.wp }} uses: ./.github/workflows/reusable-upgrade-testing.yml - if: ${{ github.repository == 'WordPress/wordpress-develop' || ( github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' ) }} + if: ${{ github.repository == 'WordPress/wordpress-develop' }} needs: [ build ] strategy: fail-fast: false @@ -83,6 +84,36 @@ jobs: new-version: develop multisite: ${{ matrix.multisite }} + # Run a limited set of upgrade tests for the current branch on forks. + upgrade-tests-develop-forks: + name: Upgrade from ${{ matrix.wp }} + uses: ./.github/workflows/reusable-upgrade-testing.yml + if: ${{ github.repository != 'WordPress/wordpress-develop' }} + needs: [ build ] + strategy: + fail-fast: false + matrix: + os: [ 'ubuntu-24.04' ] + php: [ '7.2', '8.4' ] + db-type: [ 'mysql' ] + db-version: [ '8.4' ] + # WordPress 4.9 is the oldest version that supports PHP 7.2. + wp: [ '6.7', '6.8' ] + multisite: [ false, true ] + + exclude: + # The PHP <= 7.3/MySQL 8.4 jobs currently fail due to mysql_native_password being disabled by default. See https://core.trac.wordpress.org/ticket/61218. + - php: '7.2' + db-version: '8.4' + with: + os: ${{ matrix.os }} + php: ${{ matrix.php }} + db-type: ${{ matrix.db-type }} + db-version: ${{ matrix.db-version }} + wp: ${{ matrix.wp }} + new-version: develop + multisite: ${{ matrix.multisite }} + slack-notifications: name: Slack Notifications uses: ./.github/workflows/slack-notifications.yml diff --git a/.github/workflows/upgrade-testing.yml b/.github/workflows/upgrade-testing.yml index 6090d48eb0ce6..c31a296ecbada 100644 --- a/.github/workflows/upgrade-testing.yml +++ b/.github/workflows/upgrade-testing.yml @@ -58,7 +58,7 @@ jobs: upgrade-tests-recent-releases: name: ${{ matrix.wp }} to ${{ inputs.new-version && inputs.new-version || 'latest' }} uses: ./.github/workflows/reusable-upgrade-testing.yml - if: ${{ github.repository == 'WordPress/wordpress-develop' || ( github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' ) }} + if: ${{ github.repository == 'WordPress/wordpress-develop' }} strategy: fail-fast: false matrix: @@ -93,7 +93,7 @@ jobs: upgrade-tests-wp-6x-mysql: name: ${{ matrix.wp }} to ${{ inputs.new-version && inputs.new-version || 'latest' }} uses: ./.github/workflows/reusable-upgrade-testing.yml - if: ${{ github.repository == 'WordPress/wordpress-develop' || ( github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' ) }} + if: ${{ github.repository == 'WordPress/wordpress-develop' }} strategy: fail-fast: false matrix: @@ -121,7 +121,7 @@ jobs: upgrade-tests-wp-5x-php-7x-mysql: name: ${{ matrix.wp }} to ${{ inputs.new-version && inputs.new-version || 'latest' }} uses: ./.github/workflows/reusable-upgrade-testing.yml - if: ${{ github.repository == 'WordPress/wordpress-develop' || ( github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' ) }} + if: ${{ github.repository == 'WordPress/wordpress-develop' }} strategy: fail-fast: false matrix: @@ -153,7 +153,7 @@ jobs: upgrade-tests-wp-5x-php-8x-mysql: name: ${{ matrix.wp }} to ${{ inputs.new-version && inputs.new-version || 'latest' }} uses: ./.github/workflows/reusable-upgrade-testing.yml - if: ${{ github.repository == 'WordPress/wordpress-develop' || ( github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' ) }} + if: ${{ github.repository == 'WordPress/wordpress-develop' }} strategy: fail-fast: false matrix: @@ -181,7 +181,7 @@ jobs: upgrade-tests-oldest-wp-mysql: name: ${{ matrix.wp }} to ${{ inputs.new-version && inputs.new-version || 'latest' }} uses: ./.github/workflows/reusable-upgrade-testing.yml - if: ${{ github.repository == 'WordPress/wordpress-develop' || ( github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' ) }} + if: ${{ github.repository == 'WordPress/wordpress-develop' }} strategy: fail-fast: false matrix: diff --git a/src/wp-activate.php b/src/wp-activate.php index f4fd8d76c31a7..2ba58ee76f131 100644 --- a/src/wp-activate.php +++ b/src/wp-activate.php @@ -23,6 +23,7 @@ list( $activate_path ) = explode( '?', wp_unslash( $_SERVER['REQUEST_URI'] ) ); $activate_cookie = 'wp-activate-' . COOKIEHASH; + $key = ''; $result = null;