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 a7ce202 commit 9e6f6e0
Show file tree
Hide file tree
Showing 18 changed files with 143 additions and 130 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"automattic/jetpack-composer-plugin": "^3.0.0",
"automattic/jetpack-config": "^3.0.0",
"automattic/jetpack-publicize": "^0.56.0-alpha",
"automattic/jetpack-connection": "^6.0.0",
"automattic/jetpack-connection": "^6.0.1-alpha",
"automattic/jetpack-my-jetpack": "^5.0.0",
"automattic/jetpack-sync": "^4.0.0",
"automattic/jetpack-status": "^5.0.0",
Expand Down
2 changes: 1 addition & 1 deletion jetpack_vendor/automattic/jetpack-boost-core/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
8 changes: 8 additions & 0 deletions jetpack_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
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 jetpack_vendor/automattic/jetpack-explat/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
2 changes: 1 addition & 1 deletion jetpack_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 jetpack_vendor/automattic/jetpack-licensing/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": {
"automattic/wordbless": "@dev",
Expand Down
2 changes: 1 addition & 1 deletion jetpack_vendor/automattic/jetpack-my-jetpack/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"automattic/jetpack-admin-ui": "^0.5.0",
"automattic/jetpack-assets": "^3.0.0",
"automattic/jetpack-boost-speed-score": "^0.4.0",
"automattic/jetpack-connection": "^6.0.0",
"automattic/jetpack-connection": "^6.0.1-alpha",
"automattic/jetpack-explat": "^0.2.0",
"automattic/jetpack-jitm": "^4.0.0",
"automattic/jetpack-licensing": "^3.0.0",
Expand Down
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",
"automattic/jetpack-plugins-installer": "^0.5.0",
"automattic/jetpack-sync": "^4.0.0",
"automattic/jetpack-protect-models": "^0.4.0",
Expand Down
2 changes: 1 addition & 1 deletion jetpack_vendor/automattic/jetpack-publicize/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",
"automattic/jetpack-autoloader": "^4.0.0",
"automattic/jetpack-config": "^3.0.0",
"automattic/jetpack-assets": "^3.0.0",
Expand Down
2 changes: 1 addition & 1 deletion jetpack_vendor/automattic/jetpack-sync/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",
"automattic/jetpack-constants": "^3.0.0",
"automattic/jetpack-password-checker": "^0.4.0",
"automattic/jetpack-ip": "^0.4.0",
Expand Down
2 changes: 1 addition & 1 deletion jetpack_vendor/i18n-map.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
),
'jetpack-connection' => array(
'path' => 'jetpack_vendor/automattic/jetpack-connection',
'ver' => '6.0.0',
'ver' => '6.0.1-alpha1731686094',
),
'jetpack-explat' => array(
'path' => 'jetpack_vendor/automattic/jetpack-explat',
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 9e6f6e0

Please sign in to comment.