Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
70ee81b
REST API: Harden Real Time Collaboration endpoint.
peterwilsoncc Apr 2, 2026
ec21e5a
Collaboration: Add dedicated database table and storage backend
josephfusco Mar 16, 2026
b80493c
Collaboration: Replace sync server with collaboration server
josephfusco Mar 16, 2026
3dcffcb
Collaboration: Remove legacy post meta storage and post type
josephfusco Mar 16, 2026
451bcd0
Collaboration: Wire up bootstrap, feature gate, and cron cleanup
josephfusco Mar 16, 2026
222099c
Tests: Add collaboration server tests and remove legacy sync tests
josephfusco Mar 16, 2026
31afb20
Collaboration: Use persistent object cache for awareness reads
josephfusco Mar 16, 2026
251e842
Tests: Fix REST schema and multisite test failures
josephfusco Mar 16, 2026
c76b60f
Tests: Remove erroneous connector fixtures from merge artifact
josephfusco Mar 16, 2026
25bb45b
Collaboration: Rename update_value column to data
josephfusco Mar 17, 2026
7a23617
Collaboration: Add type_client_id index and bump db_version
josephfusco Mar 17, 2026
8abdc51
Collaboration: Add payload limit constants and request validation
josephfusco Mar 17, 2026
8735cb2
Collaboration: Harden entity permission checks
josephfusco Mar 17, 2026
7280894
Collaboration: Add tests for payload limits and permission hardening
josephfusco Mar 17, 2026
c520a24
Collaboration: Apply coding standards and clarifications to table sto…
josephfusco Mar 17, 2026
19f9cab
Collaboration: Clean up stale data and unschedule cron when disabled
josephfusco Mar 17, 2026
f6806c8
Collaboration: Remove backward-compatible wp-sync/v1 route alias
josephfusco Mar 17, 2026
b3f9551
Collaboration: Move implementation details from docblock to code comment
josephfusco Mar 17, 2026
80aa9cc
Collaboration: Remove deprecated wp-sync/v1 route test
josephfusco Mar 17, 2026
62356ac
Collaboration: Add test for client ID reactivation after awareness ex…
josephfusco Mar 17, 2026
e1d31d1
Revert "Collaboration: Remove deprecated wp-sync/v1 route test"
josephfusco Mar 17, 2026
10f0a0e
Revert "Collaboration: Remove backward-compatible wp-sync/v1 route al…
josephfusco Mar 17, 2026
754347d
Collaboration: Harden storage layer, fix duplicate awareness rows, an…
josephfusco Mar 18, 2026
d00bcf2
Collaboration: Add missing maxItems to REST schema fixture
josephfusco Mar 18, 2026
5e2eb5c
Collaboration: Rename remove_updates_up_to_cursor to remove_updates_t…
josephfusco Mar 18, 2026
0f7b3da
Collaboration: Fix PHPCS alignment warnings in tests
josephfusco Mar 18, 2026
4970e5e
Collaboration: Fix REST schema fixture property order
josephfusco Mar 18, 2026
a9ca1bb
Merge branch 'trunk' into collaboration/single-table
josephfusco Mar 18, 2026
6a1b00f
Changes that did not make their way over.
desrosj Apr 24, 2026
a3d26f6
Update the generated API file.
desrosj Apr 24, 2026
ede6526
Update the generated fixture.
desrosj Apr 24, 2026
97877df
Fix fixture, take 2.
desrosj Apr 24, 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 (
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',
data longtext NOT NULL,
date_gmt datetime NOT NULL default '0000-00-00 00:00:00',
PRIMARY KEY (id),
KEY type_client_id (type,client_id),
KEY room (room,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
46 changes: 43 additions & 3 deletions src/wp-includes/collaboration.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
*
* 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.
* Otherwise, the feature requires both the 'wp_collaboration_enabled'
* option and the database schema introduced in db_version 61841.
*
* @since 7.0.0
*
Expand All @@ -20,7 +21,8 @@
function wp_is_collaboration_enabled() {
return (
wp_is_collaboration_allowed() &&
(bool) get_option( 'wp_collaboration_enabled' )
get_option( 'wp_collaboration_enabled' ) &&
get_option( 'db_version' ) >= 61841
);
}

Expand All @@ -34,7 +36,7 @@ function wp_is_collaboration_enabled() {
*
* @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 ( ! defined( 'WP_ALLOW_COLLABORATION' ) ) {
Expand Down Expand Up @@ -83,3 +85,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' );
}

/* 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.
$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