WP_Sync_Post_Meta_Storage::remove_updates_before_cursor( string $room, int $cursor ): bool

In this article

Removes updates from a room that are older than the given cursor.

Parameters

$roomstringrequired
Room identifier.
$cursorintrequired
Remove updates with meta_id < this cursor.

Return

bool True on success, false on failure.

Source

public function remove_updates_before_cursor( string $room, int $cursor ): bool {
	global $wpdb;

	$post_id = $this->get_storage_post_id( $room );
	if ( null === $post_id ) {
		return false;
	}

	$deleted_rows = $wpdb->query(
		$wpdb->prepare(
			"DELETE FROM {$wpdb->postmeta} WHERE post_id = %d AND meta_key = %s AND meta_id < %d",
			$post_id,
			self::SYNC_UPDATE_META_KEY,
			$cursor
		)
	);

	if ( false === $deleted_rows ) {
		return false;
	}

	return true;
}

Changelog

VersionDescription
7.0.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.