Skip to content

Commit

Permalink
Sync: Move check for IDC safe mode after check for connection (#39205)
Browse files Browse the repository at this point in the history
* Move check for IDC safe mode inside check for connection
This saves an extra request for get_option() looking for `jetpack_sync_error_idc`

* changelog

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

Upstream-Ref: Automattic/jetpack@b790584
  • Loading branch information
oskosk authored and matticbot committed Sep 3, 2024
1 parent 5e83c78 commit 483802b
Show file tree
Hide file tree
Showing 11 changed files with 138 additions and 129 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"automattic/jetpack-search": "^0.45.1-alpha",
"automattic/jetpack-stats": "^0.13.1",
"automattic/jetpack-status": "^3.3.4",
"automattic/jetpack-sync": "^3.9.0"
"automattic/jetpack-sync": "^3.9.1-alpha"
},
"require-dev": {
"automattic/jetpack-changelogger": "^4.2.6",
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 @@ -17,7 +17,7 @@
"automattic/jetpack-constants": "^2.0.4",
"automattic/jetpack-plans": "^0.4.8",
"automattic/jetpack-status": "^3.3.4",
"automattic/jetpack-sync": "^3.9.0",
"automattic/jetpack-sync": "^3.9.1-alpha",
"automattic/jetpack-protect-status": "^0.1.3"
},
"require-dev": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"php": ">=7.0",
"automattic/jetpack-connection": "^3.0.0-alpha",
"automattic/jetpack-plugins-installer": "^0.4.2",
"automattic/jetpack-sync": "^3.9.0",
"automattic/jetpack-sync": "^3.9.1-alpha",
"automattic/jetpack-protect-models": "^0.2.1",
"automattic/jetpack-plans": "^0.4.8"
},
Expand Down
2 changes: 1 addition & 1 deletion jetpack_vendor/automattic/jetpack-search/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"automattic/jetpack-status": "^3.3.4",
"automattic/jetpack-config": "^2.0.4",
"automattic/jetpack-my-jetpack": "^4.34.1-alpha",
"automattic/jetpack-sync": "^3.9.0"
"automattic/jetpack-sync": "^3.9.1-alpha"
},
"require-dev": {
"automattic/jetpack-changelogger": "^4.2.6",
Expand Down
8 changes: 8 additions & 0 deletions jetpack_vendor/automattic/jetpack-sync/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).

## [3.9.1-alpha] - unreleased

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

### Changed
- Optimized performance by moving the IDC safe mode check after the connection check, reducing unnecessary get_option() requests for jetpack_sync_error_idc

## [3.9.0] - 2024-08-30
### Added
- Add share status log modal to published posts [#39051]
Expand Down Expand Up @@ -1262,6 +1269,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Packages: Move sync to a classmapped package

[3.9.1-alpha]: https://github.com/Automattic/jetpack-sync/compare/v3.9.0...v3.9.1-alpha
[3.9.0]: https://github.com/Automattic/jetpack-sync/compare/v3.8.1...v3.9.0
[3.8.1]: https://github.com/Automattic/jetpack-sync/compare/v3.8.0...v3.8.1
[3.8.0]: https://github.com/Automattic/jetpack-sync/compare/v3.7.1...v3.8.0
Expand Down
9 changes: 5 additions & 4 deletions jetpack_vendor/automattic/jetpack-sync/src/class-actions.php
Original file line number Diff line number Diff line change
Expand Up @@ -304,17 +304,18 @@ public static function sync_allowed() {
return false;
}

if ( ( new Status() )->in_safe_mode() ) {
return false;
}

$connection = new Jetpack_Connection();
if ( ! $connection->is_connected() ) {
if ( ! doing_action( 'jetpack_site_registered' ) ) {
return false;
}
}

// By now, we know the site is connected, so we can return false if in safe mode.
if ( ( new Status() )->in_safe_mode() ) {
return false;
}

return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/
class Package_Version {

const PACKAGE_VERSION = '3.9.0';
const PACKAGE_VERSION = '3.9.1-alpha';

const PACKAGE_SLUG = 'sync';

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 @@ -74,7 +74,7 @@
),
'jetpack-sync' => array(
'path' => 'jetpack_vendor/automattic/jetpack-sync',
'ver' => '3.9.0',
'ver' => '3.9.1-alpha1725379611',
),
),
);
66 changes: 33 additions & 33 deletions vendor/composer/installed.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-a8c-mc-stats",
"reference": "8b49537b9eed305b7d3da95323c37d8acb0b7ee4"
"reference": "6c89650a08205add371d25fb8b2f7ce0ecdbbea5"
},
"require": {
"php": ">=7.0"
Expand Down Expand Up @@ -60,7 +60,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-admin-ui",
"reference": "b6ca7d4f017862fa0948f893aa6d6901ac54642a"
"reference": "8c703bd67dacc740a7df9c760498f88e6e4ea563"
},
"require": {
"php": ">=7.0"
Expand Down Expand Up @@ -125,7 +125,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-assets",
"reference": "c0eb72705406639ec6fdd022f30f389927d7105f"
"reference": "7769d24cb81c45e8dc8539f7ba6a5a1edb77aa08"
},
"require": {
"automattic/jetpack-constants": "^2.0.4",
Expand Down Expand Up @@ -194,7 +194,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-autoloader",
"reference": "c767157aed985a99fa67633b15ec5035058732bf"
"reference": "8700ac6e0e6f8259a4395a3c723a5e7af723b489"
},
"require": {
"composer-plugin-api": "^1.1 || ^2.0",
Expand Down Expand Up @@ -261,7 +261,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-boost-core",
"reference": "fbfcba9b442a81a36735e4a991a118cfa2c0f923"
"reference": "11f4973e0cab43e9eb851fffa8345a8b68c62ded"
},
"require": {
"automattic/jetpack-connection": "^3.0.0-alpha",
Expand Down Expand Up @@ -329,7 +329,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-boost-speed-score",
"reference": "302d40b9adf11f0843ac57aefa8f8c3b260fd445"
"reference": "adaccb9295f68412ab77e91456cc874118cb0e7c"
},
"require": {
"automattic/jetpack-boost-core": "^0.2.9",
Expand Down Expand Up @@ -405,7 +405,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-composer-plugin",
"reference": "b7f591579bfbd591a483f6558817aa1c09e1ee80"
"reference": "67f23afe5ae13fdb02423c10ad958f1c1506a22e"
},
"require": {
"composer-plugin-api": "^2.1.0",
Expand Down Expand Up @@ -465,7 +465,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-config",
"reference": "26d2bdb2d6bb0b8fa00c6aebc5763780638cf6f6"
"reference": "929de1bd2a3739660ecd4a55edc9f84e38949c8f"
},
"require": {
"php": ">=7.0"
Expand Down Expand Up @@ -540,7 +540,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-connection",
"reference": "236460f002913cbe0d77e0cb5cd1204338074201"
"reference": "517c5602c8c04b4189f82cc9a72e87d2514bb8b4"
},
"require": {
"automattic/jetpack-a8c-mc-stats": "^2.0.2",
Expand Down Expand Up @@ -630,7 +630,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-constants",
"reference": "ed62e1c0c97eb2329e87ed9ffbe1bd0bdcecf52d"
"reference": "e12b134871c23398c71c1038a9a99af03bc6403b"
},
"require": {
"php": ">=7.0"
Expand Down Expand Up @@ -684,7 +684,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-device-detection",
"reference": "4f628b4c17f202f3be14bba5e75033bd90ee1fb8"
"reference": "662f93708129a9059053ab31dbdff561900b1205"
},
"require": {
"php": ">=7.0"
Expand Down Expand Up @@ -737,7 +737,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-explat",
"reference": "cb261253e1aa259b5974debc0a730357af4992e4"
"reference": "78664d6080bcd60905b1dee471789ec8de4403df"
},
"require": {
"automattic/jetpack-connection": "^3.0.0-alpha",
Expand Down Expand Up @@ -812,7 +812,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-ip",
"reference": "18a28f308895b0e2289bcbe5773d5d4929f39a4e"
"reference": "e71fe3747c15212b900384584f7f331c9c8278ce"
},
"require": {
"php": ">=7.0"
Expand Down Expand Up @@ -870,7 +870,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-jitm",
"reference": "2ab30fd8d64dcb1c7e9409fd34005231a391e99d"
"reference": "f3e97afb867ae5e40e13804d773269f7d195fed6"
},
"require": {
"automattic/jetpack-a8c-mc-stats": "^2.0.2",
Expand Down Expand Up @@ -945,7 +945,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-licensing",
"reference": "de1fecae972b464edd8065c6b6cfb51d268dc48a"
"reference": "579658cd1400b5fb39b4ce11074db52047b2f73a"
},
"require": {
"automattic/jetpack-connection": "^3.0.0-alpha",
Expand Down Expand Up @@ -1007,7 +1007,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-logo",
"reference": "ee22f794c75f575a05e8069208482a21b703a0a3"
"reference": "b64c1544d97fc97ebc6959c3505406eccdb01a11"
},
"require": {
"php": ">=7.0"
Expand Down Expand Up @@ -1060,7 +1060,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-my-jetpack",
"reference": "fa03c70b48a6793bc24bf13d1b61a072932b75df"
"reference": "3dd091d9d470e6a90a0929f58ba43bc324210694"
},
"require": {
"automattic/jetpack-admin-ui": "^0.4.4",
Expand All @@ -1076,7 +1076,7 @@
"automattic/jetpack-protect-status": "^0.1.3",
"automattic/jetpack-redirect": "^2.0.3",
"automattic/jetpack-status": "^3.3.4",
"automattic/jetpack-sync": "^3.9.0",
"automattic/jetpack-sync": "^3.9.1-alpha",
"php": ">=7.0"
},
"require-dev": {
Expand Down Expand Up @@ -1162,7 +1162,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-password-checker",
"reference": "4686a179ea47b648de6857b93f3e06ad77931d6e"
"reference": "aa7af3aa4722c31881365ddb184bf1b78723840f"
},
"require": {
"php": ">=7.0"
Expand Down Expand Up @@ -1223,7 +1223,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-plans",
"reference": "76109b4fb43bc507b90fb14c327b1093e7283198"
"reference": "6fc76d3a8d5f61efd8a40b89ab53d57dfc40138b"
},
"require": {
"automattic/jetpack-connection": "^3.0.0-alpha",
Expand Down Expand Up @@ -1291,7 +1291,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-plugins-installer",
"reference": "760a7bca333981afcb2e90ab3af7080b74c4fed5"
"reference": "e59332ff16e72a6dbd38dbdddcbd6f5bd8548c36"
},
"require": {
"automattic/jetpack-a8c-mc-stats": "^2.0.2",
Expand Down Expand Up @@ -1347,7 +1347,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-protect-models",
"reference": "cf7755df381a710bc34876c80867513627adfa9c"
"reference": "9bb5c00c938e51c75e7c178a32cba7a42de906e7"
},
"require": {
"php": ">=7.0"
Expand Down Expand Up @@ -1417,14 +1417,14 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-protect-status",
"reference": "c447298bfaedb3fefe190ebe2129765c9c57a935"
"reference": "67e01374f750e396d5b1e3a68ee2ff67b85a6227"
},
"require": {
"automattic/jetpack-connection": "^3.0.0-alpha",
"automattic/jetpack-plans": "^0.4.8",
"automattic/jetpack-plugins-installer": "^0.4.2",
"automattic/jetpack-protect-models": "^0.2.1",
"automattic/jetpack-sync": "^3.9.0",
"automattic/jetpack-sync": "^3.9.1-alpha",
"php": ">=7.0"
},
"require-dev": {
Expand Down Expand Up @@ -1492,7 +1492,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-redirect",
"reference": "00d80bab3ff6cc9a41d04b00e9dfbcba0a9a5eb3"
"reference": "9f52b277fd7209b931cc5411724afea93adc4dfe"
},
"require": {
"automattic/jetpack-status": "^3.3.4",
Expand Down Expand Up @@ -1547,7 +1547,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-roles",
"reference": "8f14cd9df9edd5a6c5b82bed14bd3aa491dc62da"
"reference": "7efc87eb8dfc2eae963df89f5d892df5c1fb1229"
},
"require": {
"php": ">=7.0"
Expand Down Expand Up @@ -1601,7 +1601,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-search",
"reference": "0322c3bd3973d8cadc9195216dcda87b7830b758"
"reference": "f2dd165fa9ec373bbe8d1c354045b7c33ea26180"
},
"require": {
"automattic/jetpack-assets": "^2.3.6-alpha",
Expand All @@ -1610,7 +1610,7 @@
"automattic/jetpack-constants": "^2.0.4",
"automattic/jetpack-my-jetpack": "^4.34.1-alpha",
"automattic/jetpack-status": "^3.3.4",
"automattic/jetpack-sync": "^3.9.0",
"automattic/jetpack-sync": "^3.9.1-alpha",
"php": ">=7.0"
},
"require-dev": {
Expand Down Expand Up @@ -1689,7 +1689,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-stats",
"reference": "a397f94e86007a98d4cea8e3eb59a418c2aa54f1"
"reference": "0e92241789d5d3f06bc149cbbd48e749023066c8"
},
"require": {
"automattic/jetpack-connection": "^3.0.0-alpha",
Expand Down Expand Up @@ -1756,7 +1756,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-status",
"reference": "ea94ce0be20c50c4d74d1a91078a4c7bfcde0aa1"
"reference": "2d53568643f09a9e34726b09512358a888e38cd9"
},
"require": {
"automattic/jetpack-constants": "^2.0.4",
Expand Down Expand Up @@ -1815,12 +1815,12 @@
},
{
"name": "automattic/jetpack-sync",
"version": "3.9.0",
"version_normalized": "3.9.0.0",
"version": "3.9.1-alpha.1725379611",
"version_normalized": "3.9.1.0-alpha1725379611",
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-sync",
"reference": "d06556c536739289724f8727ef6c9c7f1bb8ff84"
"reference": "8fe4ea916cb47349aa9a27635e8c4bdd61b60353"
},
"require": {
"automattic/jetpack-connection": "^3.0.0-alpha",
Expand Down
Loading

0 comments on commit 483802b

Please sign in to comment.