Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
85be643
Collaboration: Add dedicated database table and storage backend
josephfusco Mar 16, 2026
a4f8b98
Collaboration: Replace sync server with collaboration server
josephfusco Mar 16, 2026
da8317c
Collaboration: Remove legacy post meta storage and post type
josephfusco Mar 16, 2026
b06269e
Collaboration: Wire up bootstrap, feature gate, and cron cleanup
josephfusco Mar 16, 2026
886f0b1
Tests: Add collaboration server tests and remove legacy sync tests
josephfusco Mar 16, 2026
6827989
Collaboration: Use persistent object cache for awareness reads
josephfusco Mar 16, 2026
9bcbfe6
Tests: Fix REST schema and multisite test failures
josephfusco Mar 16, 2026
09d0b86
Tests: Remove erroneous connector fixtures from merge artifact
josephfusco Mar 16, 2026
7455141
Collaboration: Rename update_value column to data
josephfusco Mar 17, 2026
d4e27d4
Collaboration: Add type_client_id index and bump db_version
josephfusco Mar 17, 2026
ef00730
Merge branch 'trunk' into collaboration/single-table
josephfusco Mar 17, 2026
9b45174
Collaboration: Add payload limit constants and request validation
josephfusco Mar 17, 2026
dd319b8
Collaboration: Harden entity permission checks
josephfusco Mar 17, 2026
cd4a69f
Collaboration: Add tests for payload limits and permission hardening
josephfusco Mar 17, 2026
442798f
Collaboration: Apply coding standards and clarifications to table sto…
josephfusco Mar 17, 2026
2e7c177
Collaboration: Clean up stale data and unschedule cron when disabled
josephfusco Mar 17, 2026
24f4fdc
Collaboration: Remove backward-compatible wp-sync/v1 route alias
josephfusco Mar 17, 2026
14ba560
Collaboration: Move implementation details from docblock to code comment
josephfusco Mar 17, 2026
318051f
Collaboration: Remove deprecated wp-sync/v1 route test
josephfusco Mar 17, 2026
543bc6b
Collaboration: Add test for client ID reactivation after awareness ex…
josephfusco Mar 17, 2026
ba4ab78
Revert "Collaboration: Remove deprecated wp-sync/v1 route test"
josephfusco Mar 17, 2026
d833d2f
Revert "Collaboration: Remove backward-compatible wp-sync/v1 route al…
josephfusco Mar 17, 2026
030bbce
Collaboration: Harden storage layer, fix duplicate awareness rows, an…
josephfusco Mar 18, 2026
a5d543d
Collaboration: Add missing maxItems to REST schema fixture
josephfusco Mar 18, 2026
85b7491
Collaboration: Rename remove_updates_up_to_cursor to remove_updates_t…
josephfusco Mar 18, 2026
45c639a
Collaboration: Fix PHPCS alignment warnings in tests
josephfusco Mar 18, 2026
0d3d425
Collaboration: Fix REST schema fixture property order
josephfusco Mar 18, 2026
d812496
Merge branch 'trunk' into collaboration/single-table
josephfusco Mar 18, 2026
20131ec
Merge branch 'trunk' into collaboration/single-table
josephfusco Mar 18, 2026
52fc395
Apply suggestion from @peterwilsoncc
josephfusco Mar 19, 2026
1ef60f8
Update src/wp-includes/collaboration/class-wp-collaboration-table-sto…
josephfusco Mar 19, 2026
a988544
Update src/wp-includes/collaboration.php
josephfusco Mar 19, 2026
1a61f33
Collaboration: Merge upstream trunk and adopt wp_collaboration_enable…
josephfusco Mar 19, 2026
92fdc53
Collaboration: Fix test setup for opt-in default
josephfusco Mar 19, 2026
e7ac605
Collaboration: Add tests for cursor uniqueness, LIKE queries, and typ…
josephfusco Mar 19, 2026
a53685f
Collaboration: Add HTTP method rejection and request validation tests
josephfusco Mar 19, 2026
b55f3ce
Collaboration: Harden tests with exact assertions and split multi-sce…
josephfusco Mar 19, 2026
d4ea091
Collaboration: Fix PHPCS errors in tests
josephfusco Mar 19, 2026
6332302
Collaboration: Merge upstream trunk including post meta race conditio…
josephfusco Mar 19, 2026
cc24661
Merge branch 'trunk' into collaboration/single-table
josephfusco Mar 19, 2026
0be5c73
Merge branch 'trunk' into collaboration/single-table
josephfusco Mar 19, 2026
5f320b6
Merge branch 'trunk' into collaboration/single-table
josephfusco Mar 19, 2026
7bd3079
Collaboration: Add test proving sync writes do not invalidate awarene…
josephfusco Mar 19, 2026
68f2a62
Merge branch 'trunk' into collaboration/single-table
josephfusco Mar 20, 2026
4ccf903
Collaboration: Bucket awareness timestamps to 5-second intervals
josephfusco Mar 20, 2026
78ffe6f
Merge branch 'collaboration/single-table' of github.com:josephfusco/w…
josephfusco Mar 20, 2026
fb48ce3
Merge branch 'trunk' into feature/sync-updates-table
josephfusco Mar 31, 2026
465f1ba
Merge branch 'trunk' into collaboration/single-table
josephfusco Apr 1, 2026
8ae6d5a
Collaboration: Add input validation, compaction test, and remove old …
josephfusco Apr 1, 2026
0298cdd
Tests: Add compaction test for integer client IDs
josephfusco Apr 1, 2026
05e48e9
Collaboration: Fix compactor nomination for integer client IDs
josephfusco Apr 1, 2026
4df841c
Tests: Fix PHPCS coding standards in collaboration tests
josephfusco Apr 1, 2026
e724afb
Tests: Update REST API fixture for client_id schema changes
josephfusco Apr 1, 2026
870e4e0
Tests: Skip collaboration E2E tests when JS runtime is unavailable
josephfusco Apr 1, 2026
3b0be0b
Merge branch 'trunk' into collaboration/single-table
josephfusco Apr 1, 2026
ac5db07
Merge remote-tracking branch 'origin/trunk' into collaboration/single…
josephfusco Apr 2, 2026
f2730e7
Update src/wp-includes/collaboration/class-wp-collaboration-table-sto…
josephfusco Apr 10, 2026
8371c5c
Collaboration: Cap client_id at the storage column width.
josephfusco Apr 10, 2026
6e27b56
Merge branch 'trunk' into collaboration/single-table
josephfusco Apr 10, 2026
8ee5220
Collaboration: Add (room, type, date_gmt) index to the collaboration …
josephfusco Apr 10, 2026
961be20
Merge branch 'collaboration/single-table' of github.com:josephfusco/w…
josephfusco Apr 10, 2026
780f859
Merge branch 'trunk' into collaboration/single-table
josephfusco Apr 10, 2026
d549a14
Merge branch 'trunk' into collaboration/single-table
josephfusco Apr 13, 2026
cec47ab
Merge branch 'trunk' into collaboration/single-table
josephfusco Apr 16, 2026
d95a339
Update tests/qunit/fixtures/wp-api-generated.js.
peterwilsoncc Apr 16, 2026
f743e64
Prefix schema ID column with `collaboration` per other WP tables.
peterwilsoncc Apr 28, 2026
65561cd
Merge branch 'trunk' into collaboration/single-table
peterwilsoncc Apr 29, 2026
0689499
Merge branch 'trunk' into collaboration/single-table
peterwilsoncc Apr 30, 2026
994c207
Merge branch 'trunk' into collaboration/single-table
josephfusco May 5, 2026
17349fd
Update tests/phpunit/tests/rest-api/rest-collaboration-server.php
josephfusco May 5, 2026
144d238
Collaboration: Use filterable 10-second awareness timestamp granularity.
josephfusco May 5, 2026
2900bbd
Collaboration: Delete awareness cache after write instead of inline u…
josephfusco May 5, 2026
31e247e
Collaboration: Move db_version check to wp_is_collaboration_allowed().
josephfusco May 5, 2026
69d507c
Tests: Address review feedback for collaboration tests.
josephfusco May 5, 2026
b41aba7
Tests: Add assertion messages and use pre_option filter for db_version.
josephfusco May 5, 2026
797b49f
Tests: Add assertion messages to all multi-assertion collaboration te…
josephfusco May 5, 2026
92dce1f
Tests: Move cron cleanup tests to dedicated file.
josephfusco May 5, 2026
c1dea11
Tests: Fix PHPCS coding standards violations.
josephfusco May 5, 2026
d3e6328
Collaboration: Store stale compaction as update instead of dropping it.
josephfusco May 5, 2026
fe59d5c
Merge branch 'trunk' into collaboration/single-table
peterwilsoncc May 6, 2026
cd83dd5
Merge branch 'trunk' into collaboration/single-table
peterwilsoncc May 6, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/wp-admin/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,14 @@
wp_schedule_event( time(), 'daily', 'delete_expired_transients' );
}

// Schedule collaboration data cleanup.
if ( wp_is_collaboration_enabled()
&& ! wp_next_scheduled( 'wp_delete_old_collaboration_data' )
&& ! wp_installing()
) {
wp_schedule_event( time(), 'daily', 'wp_delete_old_collaboration_data' );
}

set_screen_options();

$date_format = __( 'F j, Y' );
Expand Down
14 changes: 14 additions & 0 deletions src/wp-admin/includes/schema.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,20 @@ function wp_get_db_schema( $scope = 'all', $blog_id = null ) {
KEY post_parent (post_parent),
KEY post_author (post_author),
KEY type_status_author (post_type,post_status,post_author)
) $charset_collate;
CREATE TABLE $wpdb->collaboration (
collaboration_id bigint(20) unsigned NOT NULL auto_increment,
room varchar($max_index_length) NOT NULL default '',
type varchar(32) NOT NULL default '',
client_id varchar(32) NOT NULL default '',
user_id bigint(20) unsigned NOT NULL default '0',
Comment thread
josephfusco marked this conversation as resolved.
data longtext NOT NULL,
date_gmt datetime NOT NULL default '0000-00-00 00:00:00',
PRIMARY KEY (collaboration_id),
KEY type_client_id (type,client_id),
KEY room (room,collaboration_id),
KEY room_type_date (room,type,date_gmt),
KEY date_gmt (date_gmt)
) $charset_collate;\n";

// Single site users table. The multisite flavor of the users table is handled below.
Expand Down
2 changes: 1 addition & 1 deletion src/wp-admin/includes/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -886,7 +886,7 @@ function upgrade_all() {
upgrade_682();
}

if ( $wp_current_db_version < 61644 ) {
if ( $wp_current_db_version < 61841 ) {
upgrade_700();
}

Expand Down
10 changes: 10 additions & 0 deletions src/wp-includes/class-wpdb.php
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@ class wpdb {
'term_relationships',
'termmeta',
'commentmeta',
'collaboration',
);

/**
Expand Down Expand Up @@ -404,6 +405,15 @@ class wpdb {
*/
public $posts;

/**
* WordPress Collaboration table.
*
* @since 7.0.0
*
* @var string
*/
public $collaboration;

/**
* WordPress Terms table.
*
Expand Down
49 changes: 46 additions & 3 deletions src/wp-includes/collaboration.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
*
* If the WP_ALLOW_COLLABORATION constant is false,
* collaboration is always disabled regardless of the database option.
* Otherwise, falls back to the 'wp_collaboration_enabled' option.
*
* @since 7.0.0
*
Expand All @@ -20,7 +19,7 @@
function wp_is_collaboration_enabled() {
return (
wp_is_collaboration_allowed() &&
(bool) get_option( 'wp_collaboration_enabled' )
get_option( 'wp_collaboration_enabled' )
);
}

Expand All @@ -32,11 +31,17 @@ function wp_is_collaboration_enabled() {
* The constant defaults to true, unless the WP_ALLOW_COLLABORATION
* environment variable is set to string "false".
*
* Also requires the database schema introduced in db_version 61841.
*
* @since 7.0.0
*
* @return bool Whether real-time collaboration is enabled.
* @return bool Whether real-time collaboration is allowed.
*/
function wp_is_collaboration_allowed() {
if ( get_option( 'db_version' ) < 61841 ) {
return false;
}

if ( ! defined( 'WP_ALLOW_COLLABORATION' ) ) {
$env_value = getenv( 'WP_ALLOW_COLLABORATION' );
if ( false === $env_value ) {
Expand Down Expand Up @@ -83,3 +88,41 @@ function wp_collaboration_inject_setting() {
'after'
);
}

/**
* Deletes stale collaboration data from the collaboration table.
*
* Removes non-awareness rows older than 7 days and awareness rows older
* than 60 seconds. Rows left behind by abandoned collaborative editing
* sessions are cleaned up to prevent unbounded table growth.
*
* @since 7.0.0
*/
function wp_delete_old_collaboration_data() {
global $wpdb;

if ( ! wp_is_collaboration_enabled() ) {
/*
* Collaboration was enabled in the past but has since been disabled.
* Unschedule the cron job prior to clean up so this callback does not
* continue to run.
*/
wp_clear_scheduled_hook( 'wp_delete_old_collaboration_data' );
}

Comment thread
peterwilsoncc marked this conversation as resolved.
/* Clean up rows older than 7 days. */
$wpdb->query(
$wpdb->prepare(
"DELETE FROM {$wpdb->collaboration} WHERE date_gmt < %s",
gmdate( 'Y-m-d H:i:s', time() - WEEK_IN_SECONDS )
)
);

// Clean up awareness rows older than 60 seconds.
Comment thread
peterwilsoncc marked this conversation as resolved.
$wpdb->query(
$wpdb->prepare(
"DELETE FROM {$wpdb->collaboration} WHERE type = 'awareness' AND date_gmt < %s",
gmdate( 'Y-m-d H:i:s', time() - 60 )
)
);
}
Loading
Loading