Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
317a26e
feat: replace post meta sync storage with dedicated sync_updates table
josephfusco Feb 26, 2026
1bbfc48
Update src/wp-admin/includes/upgrade.php
josephfusco Feb 27, 2026
bd80f59
Guard sync route registration against missing table
josephfusco Feb 27, 2026
5fbf56e
Add WP-Cron cleanup for wp_sync_updates table
josephfusco Feb 27, 2026
a78fcea
Replace room_hash with human-readable room column in sync_updates table
josephfusco Feb 27, 2026
9535e36
Increase sync_updates cron expiration to 7 days and drop filter
josephfusco Feb 27, 2026
547bc5a
Escape room name in sync permission error message
josephfusco Feb 27, 2026
df7b21e
Add tests for cron cleanup, hook registration, and db_version guard
josephfusco Feb 27, 2026
8ed3dd2
Extract awareness transient key into helper with md5 safeguard
josephfusco Feb 27, 2026
42ddcf8
Update tests/phpunit/tests/rest-api/rest-sync-server.php
josephfusco Feb 27, 2026
fea5739
Apply suggestions from code review
josephfusco Feb 27, 2026
f7d5118
Add maxLength validation for sync room name to match DB column size
josephfusco Feb 27, 2026
4ba33c4
Add wp_is_collaboration_enabled() helper
josephfusco Mar 3, 2026
ad6d6ac
Replace inline collaboration checks with wp_is_collaboration_enabled()
josephfusco Mar 3, 2026
c67550b
Add E2E tests for collaborative editing
josephfusco Mar 3, 2026
fc1a56c
Add production-ready docblocks to collaboration files
josephfusco Mar 3, 2026
255cde9
Refactor collaboration E2E tests to use shared utility helpers
josephfusco Mar 3, 2026
51cd57d
Merge branch 'trunk' into feature/sync-updates-table
josephfusco Mar 3, 2026
3296d5d
Apply suggestion from @westonruter
josephfusco Mar 3, 2026
c920b97
Collaboration: Split update_value column into client_id, type, and data.
josephfusco Mar 3, 2026
8d780c2
Merge branch 'feature/sync-updates-table' of https://github.com/josep…
josephfusco Mar 3, 2026
ceccbb4
Tests: Add storage-layer round-trip test for sync_updates column split.
josephfusco Mar 3, 2026
8b71153
Apply suggestion from @westonruter
josephfusco Mar 3, 2026
d1f8026
Collaboration: Restore update_value as opaque blob in sync_updates ta…
josephfusco Mar 4, 2026
90a7ced
Update src/wp-includes/collaboration/class-wp-sync-table-storage.php
josephfusco Mar 4, 2026
42839ac
Collaboration: Add data integrity proof for sync compaction.
josephfusco Mar 5, 2026
5e9c908
Merge branch 'trunk' into feature/sync-updates-table
josephfusco Mar 5, 2026
72df885
Update src/wp-includes/collaboration/class-wp-sync-table-storage.php
josephfusco Mar 5, 2026
5ed5a6b
Collaboration: Remove wp_sync_storage filter for v1.
josephfusco Mar 5, 2026
97f346c
Collaboration: Use production compaction threshold in data integrity …
josephfusco Mar 5, 2026
33666e1
Collaboration: Resolve merge conflict and update data integrity proof.
josephfusco Mar 5, 2026
183a367
Collaboration: Add sync table performance benchmark
josephfusco Mar 5, 2026
a5b54b0
Collaboration: Clean up sync benchmark output and remove dead code
josephfusco Mar 5, 2026
29a6d4c
Merge branch 'WordPress:trunk' into feature/sync-updates-table
josephfusco Mar 5, 2026
8560568
Collaboration: Rename database table and storage layer from sync to c…
josephfusco Mar 5, 2026
c287bf1
Collaboration: Rename server class and add deprecated wp-sync/v1 rout…
josephfusco Mar 5, 2026
44caa1f
Collaboration: Rename cron cleanup function and hooks
josephfusco Mar 5, 2026
62ed487
Collaboration: Rename tests and add deprecated route coverage
josephfusco Mar 5, 2026
f5eb971
Collaboration: Rename benchmark scripts and directory
josephfusco Mar 5, 2026
9007146
Collaboration: Add collaboration route fixtures to REST API schema test
josephfusco Mar 5, 2026
7a55168
Collaboration: Improve deprecated wp-sync/v1 route documentation
josephfusco Mar 5, 2026
e7fd1cd
Collaboration: Rename remaining sync references in server class
josephfusco Mar 5, 2026
7633b37
Collaboration: Rename awareness transient key prefix
josephfusco Mar 5, 2026
66927e5
Collaboration: Rename benchmark function prefix and labels
josephfusco Mar 5, 2026
3c41343
Collaboration: Replace remaining sync terminology in comments and str…
josephfusco Mar 5, 2026
8fb1eda
Rename test method names from sync to collaboration
josephfusco Mar 5, 2026
fa30d7b
Rename data loss proof script for clarity
josephfusco Mar 5, 2026
ff1e948
Update src/wp-includes/collaboration/class-wp-http-polling-collaborat…
josephfusco Mar 5, 2026
b9d7b1a
Update tests/phpunit/tests/rest-api/rest-collaboration-server.php
josephfusco Mar 5, 2026
90e9566
Update src/wp-includes/collaboration/class-wp-http-polling-collaborat…
josephfusco Mar 5, 2026
de3d356
Fix collaboration E2E tests failing due to inline script timing
josephfusco Mar 5, 2026
5296238
Replace progress bar with log lines in data loss proof script
josephfusco Mar 5, 2026
04151d5
Merge branch 'trunk' into feature/sync-updates-table
josephfusco Mar 5, 2026
41c4227
Use atomic upsert for per-client awareness rows
josephfusco Mar 6, 2026
9572d14
Remove write side effects from awareness read path
josephfusco Mar 6, 2026
b2a26bc
Clean up awareness implementation details
josephfusco Mar 6, 2026
1010f37
Refactor awareness to per-client storage rows
josephfusco Mar 6, 2026
cd67aef
Add wp_awareness table and clean up wp_collaboration schema
josephfusco Mar 6, 2026
cdf364f
Move awareness storage operations to wp_awareness table
josephfusco Mar 6, 2026
2cb8b53
Update collaboration tests for awareness table split
josephfusco Mar 6, 2026
593deca
Add wp_user_id column to wp_awareness table
josephfusco Mar 6, 2026
3d4043f
Promote wp_user_id from awareness blob to column
josephfusco Mar 6, 2026
99f351c
Add default values to collaboration and awareness schema columns
josephfusco Mar 6, 2026
83d81e9
Limit room column to varchar($max_index_length) for utf8mb4 index com…
josephfusco Mar 6, 2026
4244655
Merge branch 'trunk' into feature/sync-updates-table
josephfusco Mar 6, 2026
0166643
Fix presence e2e test locators and leave-detection timing
josephfusco Mar 7, 2026
dea2672
Tighten awareness PHPDoc types with phpstan type aliases
josephfusco Mar 7, 2026
e022380
Use is_array() for awareness state validation instead of json_last_er…
josephfusco Mar 7, 2026
55e94de
Update src/wp-includes/collaboration/class-wp-collaboration-table-sto…
josephfusco Mar 7, 2026
dcc1da8
Merge branch 'feature/sync-updates-table' of https://github.com/josep…
josephfusco Mar 7, 2026
3388e7e
Fix PHPCS equals sign alignment in collaboration tests
josephfusco Mar 7, 2026
6a57da5
Bump db_version to 61700 for awareness schema changes
josephfusco Mar 7, 2026
d15ef62
Fix room maxLength mismatch and add collaboration test coverage
josephfusco Mar 7, 2026
2d1f4ad
Move room length validation to REST schema and add boundary test
josephfusco Mar 7, 2026
bb00912
Fix @ticket annotations to use correct Trac ticket 64696
josephfusco Mar 7, 2026
7eab11e
Merge branch 'trunk' into feature/sync-updates-table
josephfusco Mar 7, 2026
0a7c6be
Bump db_version to 61834 for collaboration schema changes
josephfusco Mar 7, 2026
8ce0822
Collaboration: Merge MAX and COUNT into a single snapshot query
josephfusco Mar 7, 2026
0d77c08
Collaboration: Deduplicate awareness query for client_id ownership check
josephfusco Mar 7, 2026
f27568a
Collaboration: Add composite index for awareness room+created_at query
josephfusco Mar 7, 2026
8f64268
Tests: Add idle poll query count assertion for collaboration endpoint
josephfusco Mar 7, 2026
540a003
Collaboration: Simplify benchmark output and fix stale EXPLAIN queries
josephfusco Mar 7, 2026
93adae4
Collaboration: Fix labels and add table verification to data loss proof
josephfusco Mar 7, 2026
80ed666
Collaboration: Replace leftover sync terminology in comments
josephfusco Mar 7, 2026
3a0d1e4
Collaboration: Harden storage layer and REST schema
josephfusco Mar 7, 2026
a178258
Collaboration: Gate db_error on WP_DEBUG and fix JSON decode inconsis…
josephfusco Mar 7, 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
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@
"env:logs": "node ./tools/local-env/scripts/docker.js logs",
"env:pull": "node ./tools/local-env/scripts/docker.js pull",
"test:performance": "wp-scripts test-playwright --config tests/performance/playwright.config.js",
"test:performance:collaboration": "npm run env:cli -- eval-file tools/local-env/scripts/collaboration-perf/run.php",
"test:php": "node ./tools/local-env/scripts/docker.js run --rm php ./vendor/bin/phpunit",
"test:coverage": "npm run test:php -- --coverage-html ./coverage/html/ --coverage-php ./coverage/php/report.php --coverage-text=./coverage/text/report.txt",
"test:e2e": "wp-scripts test-playwright --config tests/e2e/playwright.config.js",
Expand Down
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
21 changes: 21 additions & 0 deletions src/wp-admin/includes/schema.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,27 @@ 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 '',
update_value longtext NOT NULL,
created_at datetime NOT NULL default '0000-00-00 00:00:00',
PRIMARY KEY (id),
KEY room (room,id),
KEY created_at (created_at)
) $charset_collate;
CREATE TABLE $wpdb->awareness (
id bigint(20) unsigned NOT NULL auto_increment,
room varchar($max_index_length) NOT NULL default '',
client_id bigint(20) unsigned NOT NULL default '0',
wp_user_id bigint(20) unsigned NOT NULL default '0',
update_value longtext NOT NULL,
created_at datetime NOT NULL default '0000-00-00 00:00:00',
PRIMARY KEY (id),
UNIQUE KEY room_client (room,client_id),
KEY room_created_at (room,created_at),
KEY created_at (created_at)
) $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 < 61699 ) {
upgrade_700();
}

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

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

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

/**
* WordPress Awareness table.
*
* @since 7.0.0
*
* @var string
*/
public $awareness;

/**
* WordPress Terms table.
*
Expand Down
50 changes: 49 additions & 1 deletion src/wp-includes/collaboration.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,21 @@
* @since 7.0.0
*/

/**
* Checks whether real-time collaboration is enabled.
*
* The feature requires both the site option and the database schema
* introduced in db_version 61699.
*
* @since 7.0.0
*
* @return bool True if collaboration is enabled, false otherwise.
*/
function wp_is_collaboration_enabled() {
return get_option( 'wp_enable_real_time_collaboration' )
&& get_option( 'db_version' ) >= 61699;
}

/**
* Injects the real-time collaboration setting into a global variable.
*
Expand All @@ -14,11 +29,44 @@
* @access private
*/
function wp_collaboration_inject_setting() {
if ( get_option( 'wp_enable_real_time_collaboration' ) ) {
if ( wp_is_collaboration_enabled() ) {
wp_add_inline_script(
'wp-core-data',
'window._wpCollaborationEnabled = true;',
'after'
);
}
}

/**
* Deletes stale collaboration data from the collaboration table.
*
* Removes collaboration 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() {
if ( ! wp_is_collaboration_enabled() ) {
return;
}

global $wpdb;

// Clean up collaboration rows older than 7 days.
$wpdb->query(
$wpdb->prepare(
"DELETE FROM {$wpdb->collaboration} WHERE created_at < %s",
gmdate( 'Y-m-d H:i:s', time() - WEEK_IN_SECONDS )
)
);

// Clean up awareness rows older than 60 seconds (2× the 30-second awareness timeout as a buffer).
$wpdb->query(
$wpdb->prepare(
"DELETE FROM {$wpdb->awareness} WHERE created_at < %s",
gmdate( 'Y-m-d H:i:s', time() - 60 )
)
);
}
Loading
Loading