Skip to content

Commit fd15f6e

Browse files
committed
feat: replace post meta sync storage with dedicated sync_updates table
1 parent f041be2 commit fd15f6e

10 files changed

Lines changed: 541 additions & 370 deletions

File tree

src/wp-admin/includes/schema.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,14 @@ function wp_get_db_schema( $scope = 'all', $blog_id = null ) {
186186
KEY post_parent (post_parent),
187187
KEY post_author (post_author),
188188
KEY type_status_author (post_type,post_status,post_author)
189+
) $charset_collate;
190+
CREATE TABLE $wpdb->sync_updates (
191+
id bigint(20) unsigned NOT NULL auto_increment,
192+
room_hash char(32) NOT NULL,
193+
update_value longtext NOT NULL,
194+
created_at datetime NOT NULL default '0000-00-00 00:00:00',
195+
PRIMARY KEY (id),
196+
KEY room_hash (room_hash,id)
189197
) $charset_collate;\n";
190198

191199
// Single site users table. The multisite flavor of the users table is handled below.

src/wp-admin/includes/upgrade.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -886,7 +886,7 @@ function upgrade_all() {
886886
upgrade_682();
887887
}
888888

889-
if ( $wp_current_db_version < 61644 ) {
889+
if ( $wp_current_db_version < 61697 ) {
890890
upgrade_700();
891891
}
892892

@@ -2508,6 +2508,16 @@ function upgrade_700() {
25082508
)
25092509
);
25102510
}
2511+
2512+
// Clean up orphaned wp_sync_storage posts from the beta1 post-meta storage approach.
2513+
if ( $wp_current_db_version < 61697 ) {
2514+
$wpdb->delete( $wpdb->postmeta, array( 'meta_key' => 'wp_sync_update' ) );
2515+
$wpdb->delete( $wpdb->postmeta, array( 'meta_key' => 'wp_sync_awareness' ) );
2516+
$wpdb->delete(
2517+
$wpdb->posts,
2518+
array( 'post_type' => 'wp_sync_storage' )
2519+
);
2520+
}
25112521
}
25122522

25132523
/**

src/wp-includes/class-wpdb.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,7 @@ class wpdb {
299299
'term_relationships',
300300
'termmeta',
301301
'commentmeta',
302+
'sync_updates',
302303
);
303304

304305
/**
@@ -404,6 +405,15 @@ class wpdb {
404405
*/
405406
public $posts;
406407

408+
/**
409+
* WordPress Sync Updates table.
410+
*
411+
* @since 7.0.0
412+
*
413+
* @var string
414+
*/
415+
public $sync_updates;
416+
407417
/**
408418
* WordPress Terms table.
409419
*

src/wp-includes/collaboration/class-wp-sync-post-meta-storage.php

Lines changed: 0 additions & 322 deletions
This file was deleted.

0 commit comments

Comments
 (0)