Automattic\WooCommerce\Internal\Admin\Schedulers
OrdersScheduler::record_failed_order_import
Record an order ID that failed analytics import.
Deduplicates IDs. When the list exceeds FAILED_ORDER_IMPORTS_CAP, the oldest ID is dropped and the overflow counter is incremented.
Метод класса: OrdersScheduler{}
Хуков нет.
Возвращает
void. Ничего (null).
Использование
$result = OrdersScheduler::record_failed_order_import( $order_id ): void;
- $order_id(int) (обязательный)
- Order or refund ID that failed to import.
Список изменений
| С версии 11.0.0 | Введена. |
Код OrdersScheduler::record_failed_order_import() OrdersScheduler::record failed order import WC 11.3.0
public static function record_failed_order_import( $order_id ): void {
$order_id = absint( $order_id );
if ( ! $order_id ) {
return;
}
$failed = self::get_failed_order_imports();
if ( in_array( $order_id, $failed['ids'], true ) ) {
return;
}
$failed['ids'][] = $order_id;
$ids_count = count( $failed['ids'] );
while ( $ids_count > self::FAILED_ORDER_IMPORTS_CAP ) {
array_shift( $failed['ids'] );
++$failed['overflow'];
--$ids_count;
}
update_option( self::FAILED_ORDER_IMPORTS_OPTION, $failed, false );
}