Skip to content

Commit

Permalink
Jetpack Sync: Drop Sync custom queue table when Jetpack is disconnect…
Browse files Browse the repository at this point in the history
…ed (#32940)

* Jetpack Sync: Drop Sync custom queue table when Jetpack is disconnected

Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/6147718679
  • Loading branch information
fgiannar authored and matticbot committed Sep 11, 2023
1 parent 5958eb9 commit e58e7bb
Show file tree
Hide file tree
Showing 9 changed files with 142 additions and 112 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"automattic/jetpack-search": "^0.38.7-alpha",
"automattic/jetpack-stats": "^0.6.5",
"automattic/jetpack-status": "^1.18.3-alpha",
"automattic/jetpack-sync": "^1.56.0",
"automattic/jetpack-sync": "^1.57.0-alpha",
"automattic/jetpack-plugins-installer": "^0.2.5"
},
"require-dev": {
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).

## [1.57.0-alpha] - unreleased

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

### Added
- Jetpack Sync: Drop Sync custom queue table when Jetpack is disconnected

## [1.56.0] - 2023-09-04
### Added
- Add wpcom_newsletter_categories_enabled site option [#32569]
Expand Down Expand Up @@ -916,6 +923,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Packages: Move sync to a classmapped package

[1.57.0-alpha]: https://github.com/Automattic/jetpack-sync/compare/v1.56.0...v1.57.0-alpha
[1.56.0]: https://github.com/Automattic/jetpack-sync/compare/v1.55.2...v1.56.0
[1.55.2]: https://github.com/Automattic/jetpack-sync/compare/v1.55.1...v1.55.2
[1.55.1]: https://github.com/Automattic/jetpack-sync/compare/v1.55.0...v1.55.1
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 @@ -48,7 +48,7 @@
"link-template": "https://github.com/Automattic/jetpack-sync/compare/v${old}...v${new}"
},
"branch-alias": {
"dev-trunk": "1.56.x-dev"
"dev-trunk": "1.57.x-dev"
}
},
"config": {
Expand Down
22 changes: 22 additions & 0 deletions jetpack_vendor/automattic/jetpack-sync/src/class-main.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
namespace Automattic\Jetpack\Sync;

use Automattic\Jetpack\Sync\Actions as Sync_Actions;
use Automattic\Jetpack\Sync\Queue\Queue_Storage_Table;

/**
* Jetpack Sync main class.
Expand All @@ -34,6 +35,9 @@ public static function configure() {
// Any hooks below are special cases that need to be declared even if Sync is not allowed.
add_action( 'jetpack_site_registered', array( 'Automattic\\Jetpack\\Sync\\Actions', 'do_initial_sync' ), 10, 0 );

// Sync clean up, when Jetpack is disconnected.
add_action( 'jetpack_site_disconnected', array( __CLASS__, 'on_jetpack_site_disconnected' ), 1000 );

// Set up package version hook.
add_filter( 'jetpack_package_versions', __NAMESPACE__ . '\Package_Version::send_package_version_to_tracker' );
}
Expand All @@ -45,6 +49,24 @@ public static function on_jetpack_idc_disconnect() {
Sender::get_instance()->uninstall();
}

/**
* Sync cleanup on shutdown.
*/
public static function on_jetpack_site_disconnected() {
add_action( 'shutdown', array( __CLASS__, 'sync_cleanup' ), 10000 );
}

/**
* Delete all sync related data on Site disconnect / clean up custom table.
* Needs to happen on shutdown to prevent fatals.
*/
public static function sync_cleanup() {
Sender::get_instance()->uninstall();

$table_storage = new Queue_Storage_Table( 'test_queue' );
$table_storage->drop_table();
}

/**
* Sets the Sync data settings.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/
class Package_Version {

const PACKAGE_VERSION = '1.56.0';
const PACKAGE_VERSION = '1.57.0-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 @@ -58,7 +58,7 @@
),
'jetpack-sync' => array(
'path' => 'jetpack_vendor/automattic/jetpack-sync',
'ver' => '1.56.0',
'ver' => '1.57.0-alpha1694442082',
),
),
);
54 changes: 27 additions & 27 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": "09bb42e91a8d8fdf17649b923c73e0f36b90b197"
"reference": "092814cd4b9e09c7c6fe3b807355d2a36f8db6a7"
},
"require-dev": {
"automattic/jetpack-changelogger": "^3.3.8",
Expand Down Expand Up @@ -57,7 +57,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-admin-ui",
"reference": "77eefffaa9e167260c256e5f743cf1e440301d9e"
"reference": "52b2356d2b431021576413442c2efe842a87b889"
},
"require-dev": {
"automattic/jetpack-changelogger": "^3.3.8",
Expand Down Expand Up @@ -119,7 +119,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-assets",
"reference": "7370cc818e35a683b6934e3807cf9a37b5a6f997"
"reference": "cf3e93cb0bdfed72cbfc100abb1dae5aeb14e7db"
},
"require": {
"automattic/jetpack-constants": "^1.6.23"
Expand Down Expand Up @@ -187,7 +187,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-autoloader",
"reference": "bf7f86d8c1036eb1ca856ed1878be7d6bdf91765"
"reference": "2c852625aef904c2c16222440285e79b7e6b973b"
},
"require": {
"composer-plugin-api": "^1.1 || ^2.0"
Expand Down Expand Up @@ -249,7 +249,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-composer-plugin",
"reference": "f8a609a37e1358c6b378dd3b9c804b3db3ade548"
"reference": "8e9e401823067517e3ee9b1812a8cdb1de8c6972"
},
"require": {
"composer-plugin-api": "^2.1.0"
Expand Down Expand Up @@ -308,7 +308,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-config",
"reference": "1fd35ff572f25a644e815b4de945a298f61356f2"
"reference": "a1405175a9ea5ceaf99cea591b17af60cc6c529b"
},
"require-dev": {
"automattic/jetpack-changelogger": "^3.3.8"
Expand Down Expand Up @@ -350,7 +350,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-connection",
"reference": "31a84fbe5c191fe6d1d0506330596393ca2bfa76"
"reference": "8b2fcbb28189f99af10f554bc94d62cdfaf454b0"
},
"require": {
"automattic/jetpack-a8c-mc-stats": "^1.4.21",
Expand Down Expand Up @@ -428,7 +428,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-constants",
"reference": "c9a7cd5e4473a6ddea826de1e633c51d7dd387b9"
"reference": "59740d8fba17596323d2ab0310dec6d6154f5a0a"
},
"require-dev": {
"automattic/jetpack-changelogger": "^3.3.8",
Expand Down Expand Up @@ -479,7 +479,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-device-detection",
"reference": "f32c5df2f65a751fe464c0149c30679c4871a54f"
"reference": "dc3213d3a1530fff264bebe76ebfa17b2b6c7c1d"
},
"require-dev": {
"automattic/jetpack-changelogger": "^3.3.8",
Expand Down Expand Up @@ -529,7 +529,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-identity-crisis",
"reference": "ed4e327d078b6b9f035680ff2dc887cbb271571d"
"reference": "e56c7ffa31d4fc274dc9228216af80c45a2b0786"
},
"require": {
"automattic/jetpack-assets": "^1.18.10",
Expand Down Expand Up @@ -607,7 +607,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-ip",
"reference": "328e69ff5a08d5db58b7dba702b25c6c54f2e942"
"reference": "ac88b7c45e983a6e1d337eccff0c4f9e3dcef6ff"
},
"require-dev": {
"automattic/jetpack-changelogger": "^3.3.8",
Expand Down Expand Up @@ -662,7 +662,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-jitm",
"reference": "fbfde805675cdf6728c19ab815c26463a6b871f4"
"reference": "84f8d117a18c5b59134a8a3bef90c806b795c759"
},
"require": {
"automattic/jetpack-a8c-mc-stats": "^1.4.21",
Expand Down Expand Up @@ -737,7 +737,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-licensing",
"reference": "540681adb5b3d5a114a7c1898ef3fc50da9b63d1"
"reference": "8dbc53c9320094bfd0c3d7bd3946cc82ad1c1cc6"
},
"require": {
"automattic/jetpack-connection": "^1.57.3-alpha"
Expand Down Expand Up @@ -798,7 +798,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-logo",
"reference": "715d5c78d177654eb00a4c089dc9818c3891c100"
"reference": "254548462950044ca00c1115792a092575c56cbb"
},
"require-dev": {
"automattic/jetpack-changelogger": "^3.3.8",
Expand Down Expand Up @@ -848,7 +848,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-my-jetpack",
"reference": "62266c64c3e7d0e28abdc5973703d9fb2c6f0440"
"reference": "ec9385b7392af8032b3b110992e78ee58b0a48e3"
},
"require": {
"automattic/jetpack-admin-ui": "^0.2.22-alpha",
Expand Down Expand Up @@ -938,7 +938,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-partner",
"reference": "f14601613269e82e38121b1707829404c51a9dc2"
"reference": "b0b9694ebd42eece78df267f0fe8f3f1a460e85e"
},
"require": {
"automattic/jetpack-connection": "^1.57.3-alpha",
Expand Down Expand Up @@ -1000,7 +1000,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-password-checker",
"reference": "cded564adcc8cefb3978c07d504f128b083ffc81"
"reference": "e26608749acf1ba419bc776dc0fb78de8eba4d9b"
},
"require-dev": {
"automattic/jetpack-changelogger": "^3.3.8",
Expand Down Expand Up @@ -1058,7 +1058,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-plugins-installer",
"reference": "777c98228e4249832e18a2575543a91eb36dd9ae"
"reference": "594e3d207e93bbd481d7edbc6db1b0097b70343e"
},
"require": {
"automattic/jetpack-a8c-mc-stats": "^1.4.21"
Expand Down Expand Up @@ -1112,7 +1112,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-redirect",
"reference": "8bdd8ff7d7f52ec4dd9e8ce627c363a2313059e7"
"reference": "befd52321ad4678029af3c7aa5054dbbec32e62d"
},
"require": {
"automattic/jetpack-status": "^1.18.3-alpha"
Expand Down Expand Up @@ -1166,7 +1166,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-roles",
"reference": "3be65f6220c749eed6caccdaa9f7dc144f05640b"
"reference": "213bd03829ddefb17a7831c39013fa84fc06ec08"
},
"require-dev": {
"automattic/jetpack-changelogger": "^3.3.8",
Expand Down Expand Up @@ -1217,7 +1217,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-search",
"reference": "bcd5aa0e87efe4760db5bb90e480d7ffa331fa22"
"reference": "e48338cb4816d1eab4806f257b134da54f3150de"
},
"require": {
"automattic/jetpack-assets": "^1.18.10",
Expand Down Expand Up @@ -1303,7 +1303,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-stats",
"reference": "096528fb3a8ddaa112d29a915993ffb33293add9"
"reference": "14715f0cbcef5c8b8724955aaf6773be553ca88f"
},
"require": {
"automattic/jetpack-assets": "^1.18.10",
Expand Down Expand Up @@ -1367,7 +1367,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-status",
"reference": "2daead569b5967d26b12253f58c85eab4e5a3f45"
"reference": "0af8f1b5ed0fbb90d90679e0e1925604fa96b699"
},
"require": {
"automattic/jetpack-constants": "^1.6.23"
Expand Down Expand Up @@ -1417,12 +1417,12 @@
},
{
"name": "automattic/jetpack-sync",
"version": "1.56.0",
"version_normalized": "1.56.0.0",
"version": "1.57.0-alpha.1694442082",
"version_normalized": "1.57.0.0-alpha1694442082",
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-sync",
"reference": "374154846408fb1d46601e8164c6b6f6aab46031"
"reference": "09279ff33abfedaf41ebf21825d92dc6db701235"
},
"require": {
"automattic/jetpack-connection": "^1.57.3-alpha",
Expand Down Expand Up @@ -1453,7 +1453,7 @@
"link-template": "https://github.com/Automattic/jetpack-sync/compare/v${old}...v${new}"
},
"branch-alias": {
"dev-trunk": "1.56.x-dev"
"dev-trunk": "1.57.x-dev"
}
},
"installation-source": "dist",
Expand Down
Loading

0 comments on commit e58e7bb

Please sign in to comment.