Automattic\WooCommerce\StoreApi\Utilities
RateLimits::get_rate_limit_row()
Get current rate limit row from DB and normalize types. This query is not cached, and returns a new rate limit row if none exists.
Метод класса: RateLimits{}
Хуков нет.
Возвращает
Объект
. Object containing reset and remaining.
Использование
$result = RateLimits::get_rate_limit_row( $action_id );
- $action_id(строка) (обязательный)
- Identifier of the action.
Код RateLimits::get_rate_limit_row() RateLimits::get rate limit row WC 8.7.0
protected static function get_rate_limit_row( $action_id ) { global $wpdb; $row = $wpdb->get_row( $wpdb->prepare( " SELECT rate_limit_expiry as reset, rate_limit_remaining as remaining FROM {$wpdb->prefix}wc_rate_limits WHERE rate_limit_key = %s AND rate_limit_expiry > %s ", $action_id, time() ), 'OBJECT' ); if ( empty( $row ) ) { $options = self::get_options(); return (object) [ 'reset' => (int) $options->seconds + time(), 'remaining' => (int) $options->limit, ]; } return (object) [ 'reset' => (int) $row->reset, 'remaining' => (int) $row->remaining, ]; }