Skip to content

Commit ae18242

Browse files
authored
Merge pull request #4900 from Automattic/develop
Staging release v20230926.1
2 parents 4a6b271 + ea056ea commit ae18242

File tree

200 files changed

+2007
-1315
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

200 files changed

+2007
-1315
lines changed

.github/workflows/changelog-summary-prod.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
egress-policy: audit
2626

2727
- name: Check out source code
28-
uses: actions/checkout@v4.0.0
28+
uses: actions/checkout@v4.1.0
2929

3030
- name: Retrieve tags
3131
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
@@ -61,7 +61,7 @@ jobs:
6161
runs-on: ubuntu-latest
6262
steps:
6363
- name: Checkout repository
64-
uses: actions/checkout@v4.0.0
64+
uses: actions/checkout@v4.1.0
6565

6666
- name: Setup PHP
6767
uses: shivammathur/[email protected]

.github/workflows/changelog-summary-staging.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
runs-on: ubuntu-latest
1717
steps:
1818
- name: Checkout repository
19-
uses: actions/checkout@v4.0.0
19+
uses: actions/checkout@v4.1.0
2020

2121
- name: Setup PHP
2222
uses: shivammathur/[email protected]

.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ jobs:
6969
MYSQL_DATABASE: wordpress_test
7070
steps:
7171
- name: Check out source code
72-
uses: actions/checkout@v4.0.0
72+
uses: actions/checkout@v4.1.0
7373
with:
7474
submodules: recursive
7575

.github/workflows/codeql-analysis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
- javascript
3030
steps:
3131
- name: Checkout repository
32-
uses: actions/checkout@v4.0.0
32+
uses: actions/checkout@v4.1.0
3333

3434
- name: Initialize CodeQL
3535
uses: github/codeql-action/init@v2

.github/workflows/core-tests.yml

+39-14
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ permissions:
2020
contents: read
2121

2222
env:
23+
LOCAL_PHP: "8.0-fpm"
24+
LOCAL_DB_TYPE: "mysql"
25+
LOCAL_DB_VERSION: "8.0"
26+
LOCAL_PHP_MEMCACHED: "true"
2327
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: "true"
2428

2529
jobs:
@@ -37,48 +41,69 @@ jobs:
3741
echo "PHP_FPM_UID=$(id -u)" >> "${GITHUB_ENV}"
3842
echo "PHP_FPM_GID=$(id -g)" >> "${GITHUB_ENV}"
3943
40-
- name: Check out WordPress
41-
uses: actions/[email protected]
44+
- name: Checkout WordPress
45+
uses: actions/checkout@v4.1.0 # v4.0.0
4246
with:
4347
repository: wordpress/wordpress-develop
4448
path: wordpress
4549
ref: ${{ steps.version.outputs.latest }}
4650

4751
- name: Check out source code
48-
uses: actions/[email protected]
52+
uses: actions/checkout@v4.1.0 # v4.0.0
4953
with:
5054
submodules: recursive
5155
path: wordpress/src/wp-content/mu-plugins
5256

53-
- name: Patch package.json for WP 6.2.2
54-
run: |
55-
sed -i 's/"version": "6.2.3"/"version": "6.2.2"/' wordpress/package.json
56-
if: steps.version.outputs.latest == '6.2.2'
57-
5857
- name: Tweaks
5958
run: |
6059
echo "define( 'VIP_JETPACK_SKIP_LOAD', 'true' );" >> "wordpress/src/wp-content/mu-plugins/000-vip-init.php"
6160
echo "GITHUB_EVENT_NAME=pull_request" >> "wordpress/.env"
6261
63-
- name: Install NodeJS
64-
uses: actions/[email protected]
62+
- name: Set up Node.js
63+
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
6564
with:
6665
node-version-file: 'wordpress/.nvmrc'
6766
cache: npm
6867
cache-dependency-path: 'wordpress/package-lock.json'
6968

70-
- name: Install Dependencies
71-
run: npm ci
72-
working-directory: wordpress
69+
- name: Set up PHP
70+
uses: shivammathur/[email protected]
71+
with:
72+
php-version: 8.0
73+
coverage: none
7374

75+
# - name: Install Composer dependencies
76+
# uses: ramsey/composer-install@83af392bf5f031813d25e6fe4cd626cdba9a2df6 # v2.2.0
77+
# with:
78+
# working-directory: wordpress
7479
- name: Install Composer dependencies
75-
run: docker-compose run --rm php composer update
80+
run: composer install -n
81+
working-directory: wordpress
82+
83+
- name: Downgrade PHPUnit
84+
run: composer require --dev -n phpunit/phpunit:9.6.12
85+
working-directory: wordpress
86+
87+
- name: Install npm dependencies
88+
run: npm ci
7689
working-directory: wordpress
7790

7891
- name: Start Docker environment
7992
run: npm run env:start
8093
working-directory: wordpress
8194

95+
- name: Log running Docker containers
96+
run: docker ps -a
97+
98+
- name: WordPress Docker container debug information
99+
run: |
100+
docker-compose run --rm mysql mysql --version
101+
docker-compose run --rm php php --version
102+
docker-compose run --rm php php -m
103+
docker-compose run --rm php php -i
104+
docker-compose run --rm php locale -a
105+
working-directory: wordpress
106+
82107
- name: Install WordPress
83108
run: npm run env:install
84109
working-directory: wordpress

.github/workflows/coverage-develop.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
MYSQL_DATABASE: wordpress_test
3737
steps:
3838
- name: Check out source code
39-
uses: actions/checkout@v4.0.0
39+
uses: actions/checkout@v4.1.0
4040
with:
4141
submodules: recursive
4242

.github/workflows/dependency-review.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
github.com:443
2121
2222
- name: Check out the source code
23-
uses: actions/checkout@v4.0.0
23+
uses: actions/checkout@v4.1.0
2424

2525
- name: Review dependencies
2626
uses: actions/dependency-review-action@v3

.github/workflows/deploy.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,19 @@ jobs:
2222
contents: write
2323
steps:
2424
- name: Check out the source code
25-
uses: actions/checkout@v4.0.0
25+
uses: actions/checkout@v4.1.0
2626
with:
2727
submodules: recursive
2828
path: ${{ env.SOURCE_REPO_PATH }}
2929

3030
- name: Check out Automattic/vip-go-mu-plugins-ext
31-
uses: actions/checkout@v4.0.0
31+
uses: actions/checkout@v4.1.0
3232
with:
3333
repository: Automattic/vip-go-mu-plugins-ext
3434
path: ${{ env.EXT_REPO_PATH }}
3535

3636
- name: Check out Automattic/vip-go-mu-plugins-built
37-
uses: actions/checkout@v4.0.0
37+
uses: actions/checkout@v4.1.0
3838
with:
3939
repository: Automattic/vip-go-mu-plugins-built
4040
path: ${{ env.TARGET_REPO_PATH }}

.github/workflows/e2e.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ jobs:
6868
wordpress.org:443
6969

7070
- name: Check out repository code
71-
uses: actions/checkout@v4.0.0
71+
uses: actions/checkout@v4.1.0
7272
with:
7373
submodules: true
7474

.github/workflows/lint.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
runs-on: ubuntu-latest
2626
steps:
2727
- name: Check out source code
28-
uses: actions/checkout@v4.0.0
28+
uses: actions/checkout@v4.1.0
2929

3030
- name: Set up PHP
3131
uses: shivammathur/[email protected]
@@ -52,7 +52,7 @@ jobs:
5252
runs-on: ubuntu-latest
5353
steps:
5454
- name: Check out source code
55-
uses: actions/checkout@v4.0.0
55+
uses: actions/checkout@v4.1.0
5656

5757
- name: Setup Node
5858
uses: actions/[email protected]

.github/workflows/parsely.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
MYSQL_DATABASE: wordpress_test
5151
steps:
5252
- name: Check out source code
53-
uses: actions/checkout@v4.0.0
53+
uses: actions/checkout@v4.1.0
5454
with:
5555
submodules: recursive
5656

.github/workflows/search-dev-tools.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
contents: write
2323
steps:
2424
- name: Check out source code
25-
uses: actions/checkout@v4.0.0
25+
uses: actions/checkout@v4.1.0
2626
with:
2727
token: ${{ secrets.WPCOM_VIP_BOT_TOKEN }}
2828

.github/workflows/search-e2e.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030

3131
steps:
3232
- name: Checkout
33-
uses: actions/checkout@v4.0.0
33+
uses: actions/checkout@v4.1.0
3434
with:
3535
submodules: recursive
3636

000-debug/debug-mode.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<?php
22

3-
use function Automattic\VIP\Stats\send_pixel;
4-
53
/**
64
* Logged out Debug Mode for VIP
75
*
@@ -18,6 +16,8 @@
1816
* about the request.
1917
*/
2018

19+
use function Automattic\VIP\Stats\send_pixel;
20+
2121
// How long should we enable Debug mode for?
2222
const COOKIE_TTL = 2 * HOUR_IN_SECONDS;
2323

@@ -109,7 +109,7 @@ function set_debug_mode( bool $set ) {
109109
}
110110

111111
function enable_debug_tools() {
112-
add_filter( 'user_has_cap', function( $user_caps, $caps, $args ) {
112+
add_filter( 'user_has_cap', function ( $user_caps, $caps, $args ) {
113113
if ( 'view_query_monitor' === $args[0] ) {
114114
$user_caps['view_query_monitor'] = true;
115115
}

000-debug/not-proxied-flag.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<?php
22

3-
namespace Automattic\VIP\NotProxiedFlag;
4-
53
/**
64
* Display 'Not Proxied' flag when not proxied.
75
*
@@ -18,6 +16,8 @@
1816
* be displayed for other users.
1917
*/
2018

19+
namespace Automattic\VIP\NotProxiedFlag;
20+
2121
add_action( 'muplugins_loaded', __NAMESPACE__ . '\enable_not_proxied_flag' );
2222

2323
function enable_not_proxied_flag() {

000-vip-init.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555

5656
// WP CLI is allowed, but disable cron
5757
if ( Context::is_wp_cli() || $allow_front_end ) {
58-
add_filter( 'pre_option_a8c_cron_control_disable_run', function() {
58+
add_filter( 'pre_option_a8c_cron_control_disable_run', function () {
5959
return 1;
6060
}, 9999 );
6161
} else {
@@ -158,7 +158,7 @@
158158
defined( 'WPCOM_VIP_MACHINE_USER_ROLE' ) || define( 'WPCOM_VIP_MACHINE_USER_ROLE', 'administrator' );
159159

160160
if ( ! defined( 'WP_INSTALLING' ) || ! WP_INSTALLING ) {
161-
add_action( 'set_current_user', function() {
161+
add_action( 'set_current_user', function () {
162162
$user = get_user_by( 'login', WPCOM_VIP_MACHINE_USER_LOGIN );
163163

164164
if ( $user && $user->ID ) {
@@ -237,7 +237,7 @@
237237

238238
//enabled on selected sites for now
239239
if ( true === defined( 'WPCOM_VIP_CLEAN_TERM_CACHE' ) && true === constant( 'WPCOM_VIP_CLEAN_TERM_CACHE' ) ) {
240-
require_once dirname( __FILE__ ) . '/vip-helpers/vip-clean-term-cache.php';
240+
require_once __DIR__ . '/vip-helpers/vip-clean-term-cache.php';
241241
}
242242

243243
// Load WP_CLI helpers
@@ -306,7 +306,7 @@
306306
}
307307

308308
// Add custom header for VIP
309-
add_filter( 'wp_headers', function( $headers ) {
309+
add_filter( 'wp_headers', function ( $headers ) {
310310
$headers['X-hacker'] = 'If you\'re reading this, you should visit wpvip.com/careers and apply to join the fun, mention this header.';
311311
$headers['X-Powered-By'] = 'WordPress VIP <https://wpvip.com>';
312312
$headers['Host-Header'] = 'a9130478a60e5f9135f765b23f26593b'; // md5 -s wpvip

001-core.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ function vip_filter_unnecessary_php_modules_for_site_health_tests( $modules ) {
126126

127127
add_filter(
128128
'use_block_editor_for_post',
129-
function( $can_edit, $post ) {
129+
function ( $can_edit, $post ) {
130130
if ( ! isset( $post->post_type ) ) {
131131
return $can_edit;
132132
}

001-core/options-api.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
namespace Automattic\VIP\Core\OptionsAPI;
66

7+
add_filter( 'pre_wp_load_alloptions', __NAMESPACE__ . '\pre_wp_load_alloptions_protections', 999, 2 );
8+
79
/**
810
* Add additional protections around the alloptions functionality.
911
*
@@ -14,7 +16,6 @@
1416
* - 1) Prevent spamming memcached & the DB if memcached is unable to add() the key to cache.
1517
* - 2) Kill the request if options cannot be retrieved from the database (or cache).
1618
*/
17-
add_filter( 'pre_wp_load_alloptions', __NAMESPACE__ . '\pre_wp_load_alloptions_protections', 999, 2 );
1819
function pre_wp_load_alloptions_protections( $pre_loaded_alloptions, $force_cache ) {
1920
global $wpdb;
2021
static $fallback_cache = [];

001-core/privacy.php

+4-6
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,11 @@ function the_vip_privacy_policy_link( $link ) {
2424
return '';
2525
}
2626

27-
$link = sprintf(
27+
return sprintf(
2828
'%s<br/><a href="https://automattic.com/privacy/">%s</a>',
2929
esc_html__( 'Powered by WordPress VIP' ),
3030
esc_html__( 'Privacy Policy' )
3131
);
32-
33-
return $link;
3432
}
3533

3634
/**
@@ -160,7 +158,7 @@ function generate_personal_data_export_file( $request_id ) {
160158
/*
161159
* Handle the JSON export.
162160
*/
163-
// phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_read_fopen
161+
// phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_fopen
164162
$file = fopen( $json_report_pathname, 'w' );
165163

166164
if ( false === $file ) {
@@ -176,7 +174,7 @@ function generate_personal_data_export_file( $request_id ) {
176174
/*
177175
* Handle the HTML export.
178176
*/
179-
// phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_read_fopen
177+
// phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_fopen
180178
$file = fopen( $html_report_pathname, 'w' );
181179

182180
if ( false === $file ) {
@@ -297,7 +295,7 @@ function generate_personal_data_export_file( $request_id ) {
297295
// ZipArchive may not be available across all applications.
298296
// Use it if it exists, otherwise fallback to PclZip.
299297
if ( class_exists( '\ZipArchive' ) ) {
300-
$zip = new \ZipArchive; // phpcs:ignore WordPress.Classes.ClassInstantiation.MissingParenthesis
298+
$zip = new \ZipArchive(); // phpcs:ignore WordPress.Classes.ClassInstantiation.MissingParenthesis
301299
if ( true === $zip->open( $local_archive_pathname, \ZipArchive::CREATE ) ) {
302300
if ( ! $zip->addFile( $json_report_pathname, 'export.json' ) ) {
303301
$error = __( 'Unable to add data to JSON file.' );

0 commit comments

Comments
 (0)