Automattic\WooCommerce\Internal\PushNotifications\DataStores
StepLogTableReader::get_window_start_timestamp
Returns the timestamp of the oldest row in the window just read, to decide whether the scan has passed the start of the range.
Method of the class: StepLogTableReader{}
No Hooks.
Returns
int|null. Null when the window held no rows at all.
Usage
// private - for code of main (parent) class only $result = $this->get_window_start_timestamp( $table, $lower ): ?int;
- $table(string) (required)
- The log table name.
- $lower(int) (required)
- The exclusive lower ID bound of the window just read.
StepLogTableReader::get_window_start_timestamp() StepLogTableReader::get window start timestamp code WC 11.3.0
private function get_window_start_timestamp( string $table, int $lower ): ?int {
global $wpdb;
$timestamp = $wpdb->get_var(
$wpdb->prepare(
"SELECT timestamp FROM {$table} WHERE log_id > %d ORDER BY log_id ASC LIMIT 1", // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared
$lower
)
);
return null === $timestamp ? null : (int) strtotime( $timestamp . ' UTC' );
}