Skip to content

Commit

Permalink
Connection: work around a WP user caching bug (#40188)
Browse files Browse the repository at this point in the history
WP bug #62003 leads to inconsistent format of cached user data in certain circumstances.
It happens if only one field gets fetched from the database, so we add ID to work around the issue.

Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/11859369283

Upstream-Ref: Automattic/jetpack@cd03f86
  • Loading branch information
sergeymitr authored and matticbot committed Nov 15, 2024
1 parent 43e93b8 commit 40e1a8e
Show file tree
Hide file tree
Showing 15 changed files with 127 additions and 114 deletions.
76 changes: 38 additions & 38 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/automattic/jetpack-blaze/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"require": {
"php": ">=7.2",
"automattic/jetpack-assets": "^3.0.0",
"automattic/jetpack-connection": "^6.0.0",
"automattic/jetpack-connection": "^6.0.1-alpha",
"automattic/jetpack-constants": "^3.0.0",
"automattic/jetpack-plans": "^0.5.0",
"automattic/jetpack-redirect": "^3.0.0",
Expand Down
8 changes: 8 additions & 0 deletions vendor/automattic/jetpack-connection/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [6.0.1-alpha] - unreleased

This is an alpha version! The changes listed here are not final.

### Fixed
- Work around a WP user caching bug (https://core.trac.wordpress.org/ticket/62003).

## [6.0.0] - 2024-11-14
### Removed
- General: Update minimum PHP version to 7.2. [#40147]
Expand Down Expand Up @@ -1247,6 +1254,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Separate the connection library into its own package.

[6.0.1-alpha]: https://github.com/Automattic/jetpack-connection/compare/v6.0.0...v6.0.1-alpha
[6.0.0]: https://github.com/Automattic/jetpack-connection/compare/v5.1.7...v6.0.0
[5.1.7]: https://github.com/Automattic/jetpack-connection/compare/v5.1.6...v5.1.7
[5.1.6]: https://github.com/Automattic/jetpack-connection/compare/v5.1.5...v5.1.6
Expand Down
7 changes: 6 additions & 1 deletion vendor/automattic/jetpack-connection/src/class-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -1620,12 +1620,17 @@ public function get_assumed_site_creation_date() {
return $cached_date;
}

/**
* We don't use the 'ID' field, but need it to overcome a WP caching bug: https://core.trac.wordpress.org/ticket/62003
*
* @todo Remote the 'ID' field from users fetching when the issue is fixed and Jetpack-supported WP versions move beyond it.
*/
$earliest_registered_users = get_users(
array(
'role' => 'administrator',
'orderby' => 'user_registered',
'order' => 'ASC',
'fields' => array( 'user_registered' ),
'fields' => array( 'ID', 'user_registered' ),
'number' => 1,
)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/
class Package_Version {

const PACKAGE_VERSION = '6.0.0';
const PACKAGE_VERSION = '6.0.1-alpha';

const PACKAGE_SLUG = 'connection';

Expand Down
2 changes: 1 addition & 1 deletion vendor/automattic/jetpack-jitm/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"php": ">=7.2",
"automattic/jetpack-a8c-mc-stats": "^3.0.0",
"automattic/jetpack-assets": "^3.0.0",
"automattic/jetpack-connection": "^6.0.0",
"automattic/jetpack-connection": "^6.0.1-alpha",
"automattic/jetpack-device-detection": "^3.0.0",
"automattic/jetpack-logo": "^3.0.0",
"automattic/jetpack-redirect": "^3.0.0",
Expand Down
2 changes: 1 addition & 1 deletion vendor/automattic/jetpack-masterbar/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"automattic/jetpack-blaze": "^0.25.0-alpha",
"automattic/jetpack-compat": "^4.0.0-alpha",
"automattic/jetpack-device-detection": "^3.0.0",
"automattic/jetpack-connection": "^6.0.0",
"automattic/jetpack-connection": "^6.0.1-alpha",
"automattic/jetpack-jitm": "^4.0.0",
"automattic/jetpack-logo": "^3.0.0",
"automattic/jetpack-plans": "^0.5.0",
Expand Down
2 changes: 1 addition & 1 deletion vendor/automattic/jetpack-mu-wpcom/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"automattic/jetpack-blocks": "^3.0.0-alpha",
"automattic/jetpack-calypsoify": "^0.2.0-alpha",
"automattic/jetpack-classic-theme-helper": "^0.7.0-alpha",
"automattic/jetpack-connection": "^6.0.0",
"automattic/jetpack-connection": "^6.0.1-alpha",
"automattic/jetpack-masterbar": "^0.10.0-alpha",
"automattic/jetpack-redirect": "^3.0.0",
"automattic/jetpack-stats-admin": "^0.23.0-alpha",
Expand Down
2 changes: 1 addition & 1 deletion vendor/automattic/jetpack-plans/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"license": "GPL-2.0-or-later",
"require": {
"php": ">=7.2",
"automattic/jetpack-connection": "^6.0.0"
"automattic/jetpack-connection": "^6.0.1-alpha"
},
"require-dev": {
"yoast/phpunit-polyfills": "^1.1.1",
Expand Down
Loading

0 comments on commit 40e1a8e

Please sign in to comment.