diff --git a/packages/sync/src/Defaults.php b/packages/sync/src/Defaults.php index 1b9104b5b781..fdb1ae3a0c54 100644 --- a/packages/sync/src/Defaults.php +++ b/packages/sync/src/Defaults.php @@ -525,6 +525,12 @@ public static function get_callable_whitelist() { 'slug', ); + static $default_term_relationships_checksum_columns = array( + 'object_id', + 'term_taxonomy_id', + 'term_order', + ); + static $default_multisite_callable_whitelist = array( 'network_name' => array( 'Jetpack', 'network_name' ), 'network_allow_new_registrations' => array( 'Jetpack', 'network_allow_new_registrations' ), diff --git a/packages/sync/src/Replicastore.php b/packages/sync/src/Replicastore.php index bce579ccb6ee..4708d9dd18e7 100644 --- a/packages/sync/src/Replicastore.php +++ b/packages/sync/src/Replicastore.php @@ -43,6 +43,11 @@ public function term_count() { return $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->terms" ); } + public function term_relationship_count() { + global $wpdb; + return $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->term_relationships" ); + } + public function post_count( $status = null, $min_id = null, $max_id = null ) { global $wpdb; @@ -659,6 +664,8 @@ function get_checksum_columns_for_object_type( $object_type ) { return Defaults::$default_post_meta_checksum_columns; case 'terms': return Defaults::$default_term_checksum_columns; + case 'term_relationships': + return Defaults::$default_term_relationships_checksum_columns; default: return false; } @@ -704,6 +711,12 @@ function checksum_histogram( $object_type, $buckets, $start_id = null, $end_id = $id_field = 'term_id'; $where_sql = '1=1'; break; + case 'term_relationships': + $object_table = $wpdb->term_relationships; + $object_count = $this->term_relationship_count(); + $id_field = 'object_id'; + $where_sql = '1=1'; + break; default: return false; }