�PNG  IHDR22?�� pHYs  �� OiCCPPhotoshop ICC profilexڝSgTS�=���BK���KoR RB���&*! J�!��Q�EEȠ�����Q, � ��!���������{�kּ������>���� �H3Q5� �B�������.@� $p�d!s�#�~<<+"��x� �M��0���B�\���t�8K�@z�B�@F���&S�`�cb�P-`'������{[�!�� e�Dh;��V�EX0fK�9�-0IWfH���� � 0Q��){`�##x��F�W<�+��*x��<�$9E�[-qWW.(�I+6aa�@.�y�2�4���������x����6��_-��"bb���ϫp@�t~��,/��;�m��%�h^ �u��f�@����W�p�~<�5�j>{�-�]c�K'Xt����o��(�h���w��?�G�%�fI�q^D$.Tʳ?�D��*�A��,���� �`6�B$��BB d�r`)��B(�Ͱ*`/�@4�Qh��p.�U�=p�a��(�� A�a!ڈb�X#����!�H�$ ɈQ"K�5H1R�T UH�=r9�\F��;�2����G1���Q=� �C��7�F� �dt1�����r�=�6��Ыhڏ>C�0��3�l0.��B�8, �c˱"� ���V����cϱw�E� 6wB aAHXLXN�H� $4� 7 �Q�'"��K�&���b21�XH,#��/{�C�7$�C2'��I��T��F�nR#�,��4H#���dk�9�, +ȅ����3��!�[ �b@q��S�(R�jJ��4�e�2AU��Rݨ�T5�ZB���R�Q��4u�9̓IK�����hh�i��t�ݕN��W���G���w ��Ljg(�gw��L�Ӌ�T071���oUX*�*|�� �J�&�*/T����ު U�U�T��^S}�FU3S� Ԗ�U��P�SSg�;���g�oT?�~Y��Y�L�OC�Q��_�� c�x,!k ��u�5�&���|v*�����=���9C3J3W�R�f?�q��tN �(���~���)�)�4L�1e\k����X�H�Q�G�6������E�Y��A�J'\'Gg����S�Sݧ �M=:��.�k���Dw�n��^��Lo��y���}/�T�m���G X� $� �<�5qo</���QC]�@C�a�a�ᄑ��<��F�F�i�\�$�m�mƣ&&!&KM�M�RM��)�;L;L���͢�֙5�=1�2��כ߷`ZxZ,����eI��Z�Yn�Z9Y�XUZ]�F���%ֻ�����N�N���gð�ɶ�����ۮ�m�}agbg�Ů��}�}��= ���Z~s�r:V:ޚΜ�?}����/gX���3��)�i�S��Ggg�s�󈋉K��.�>.���Ƚ�Jt�q]�z���������ۯ�6�i�ܟ�4�)�Y3s���C�Q��? ��0k߬~OCO�g��#/c/�W�װ��w��a�>�>r��>�<7�2�Y_�7��ȷ�O�o�_��C#�d�z����%g��A�[��z|!��?:�e����A���AA�������!h�쐭!��Α�i�P~���a�a��~ '���W�?�p�X�1�5w��Cs�D�D�Dޛg1O9�-J5*>�.j<�7�4�?�.fY��X�XIlK9.*�6nl������� �{�/�]py�����.,:�@L�N8��A*��%�w%� y��g"/�6ш�C\*N�H*Mz�쑼5y$�3�,幄'���L Lݛ:��v m2=:�1����qB�!M��g�g�fvˬe����n��/��k���Y- �B��TZ(�*�geWf�͉�9���+��̳�ې7�����ᒶ��KW-X潬j9�������(�x��oʿ�ܔ���Ĺd�f�f���-�[����n �ڴ �V����E�/��(ۻ��C���<��e����;?T�T�T�T6��ݵa��n��{��4���[���>ɾ�UUM�f�e�I���?�������m]�Nmq����#�׹���=TR��+�G�����w- 6 U����#pDy��� �� :�v�{���vg/jB��F�S��[b[�O�>����z�G��499�?r����C�d�&����ˮ/~�����јѡ�򗓿m|������������x31^�V���w�w��O�| (�h���SЧ��������c3-� cHRMz%������u0�`:�o�_�F5IDATx��ytUս�?�;���fN$$��@B�!�k��� -*�gE���j�O�kQ�ʠ`U�B_ �AÐ0%�Ȕ�@r3ޛ;߳��$�@��v����^�s����������$��ߢ !�W��5�̱'-٘������4�>�Rƫ$�G��0U�H}�_ _� #��k�MJ/=�9Du *ڲ�k�PQ;0��j|�*�$�^컂脛y���>�z×� B��� ��(�:$�ʔ_�6��C!B����MVx��a��ζyY����j��ƋY2�9�F�{r��r�딟F��Q��hY6��� x��[l��RC��������nt@��;P��3��� F�w��7��:�P���ɋ'���mj���Bƪ�$�Q�L��y��߷g��\���z����v5�p�v$�v櫻�`6~K �Y�X����,�:��"�o�e0II"(��,������l_�C���/4�+f�E�!q��:����u����c��樼.UE�@� �]K�W���$-�h]�JG���Dz)�`��.�A/ ���mᏣc�3jK� �!�>���$�Q�!�_�? \�C2(E �M$Z I{�U���s�ǣ���=��@Բe ޻��W�����@ �w����}�9v,)��.}*|"�s��di���,���G�]W�AC�������|<����[��ߕ������K�*�G nߴ!��‹��J�!��6(L�a)��Am��������;adf��:�xm��nh�;֦I��(���o�C~ډa?�=��s����h��E������xp����)���_���t��W�����´;8���`dz=(��@@�+,�;�`�fhl��XȌ�3,uI�~z(J����� �ZX�A����H'�À�㜦�82|��a�n�z2��I���� ���EY�h�ε<�0�q�{��C��v�˅��?"@��χ�x�WS+��N�~�KQ�J�8ل�� _.W��� !TU{�����,��"�� �;�������HI S� ��))�o�1�H�D� ���� (� ;����"Ҕ��,���� �F=���O��&�Ph>�`���y��߲ &S��P�<��'��1s�1cĂ�N����2)����@�u��tv��<�+�-&�����h��[!FSG���' � z z0��<����8d&�����E0�,��<��"!P�b4��� �{S�����X����.�囤���T��hEF��X�q0"-<����h���]�Py*����F⩍��@v�˂�Y08�� .q��a��s����(!<̫1�3�L�H��7sYW�`��qtu�\7��?�@�Y�� %Ka�x�GZ�*W�P��y�����N0r9��Z�c�%���q,��k�����!!,��>���IB��� �x1�Xu�Y���v-���ֺ��N������JP��a�2`�e5��w��u;�6�i���̃��(K���ťa��(l51��JL��O'%���]���ٖ뿉!��{*�p+f ���i8��D�ȑ���ܩ�M��V��ӟz��x�7Z�1i}�^͜���6e����x��)u�d�ˏ�V�eG�\�X1�����=n�U'�~Y����L�\,�(d!x ,�:�TW8� M`r���@��r+v�Q0��>^;˴�VbF��('����� �*O��i��j�Ӆ����^�S3&� ���{������.ی�� N;��NU%d0�Ce\r"�C�b��&t7N�7��� �ȪD�[%l�۪�$��'m?�A9tI�9>��NVL ��� 6v~M�����ъ�B���0����9$&=ώm��W�0���L���&��E���f�f��'+�9��hv��7,���M��6�D�&�^� �����8 D֮�����o��k^z��O��hP�8q�5d*��YVq3�{��������#LX4�?��jP=3�~�؅c�ݰ�̱�ұ��8̲��2�G�����j��έ�9��w7���U�X�w�85C��?!I&���o&����L���I#�^�eV�,�^t5�k� �xs˛\��U�8��."���{���ǵ�l4��ݼ�;��r"���G�/~���gJV�N糦��ZZ^k+NN�D��I$�=OE�z����|*�*{��%k���G��>�`9��b;�s���8,�qs��c��.b��q�%�>r��n�R�Ƨ�%�,�A��le#�8���}; 21�0�b�&�QX�f���q�00����$>�h�N�'�a3��A���/�r ��L5�8�GԲ'�����w;��c#�q1���h$*��V^�k��QĽ�b:i������� ����H F#�_���,��]g����Ը����`RUU���� ��"�qD���>-��ϤI�~��3�̴�����NZ[[555�eeek7�m����YF#[��Đ��R��i��L�H�r ��@��J-�Pŝ��_|�-��6y��ks�V�U~��6���w.����(��0A� 4��f��� /���C�xŊ�ٳ����z=6�����rg���mKo��o�/����a�g���?'9%9��P��斓��~���L{�� �H��{AW��B��$����v�1b�&Mb�ر��ر#�0`�`xMBp! )Z�Nmo�mZ�g�}�eذaWTVV ���'99��C5��&�&+5�bT>|8��PUUETT����&���t��~TE%��'������b�tEGG;RSS�S�N�v��ѯ��t����u1@�ޚ"f��͈���r'L�Ph��m��ƌ�74o��`�x�q�P���NRSS�X,�����l&&&��MFFA!-��`��ҷ�n��Yuu�����x<I�LB%����KԒ50�!�3�bz�����ʸKL���;---�l6[��`��������Ȏ;�����egg4��!D�T��jWujyZ��������K����%����p�^���X,6��sV=�ܖ����6�3�X ���4ҿ��A2�&����_k�;d�� �VfOIEND�B`�
Warning: session_start(): Session cannot be started after headers have already been sent in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 124

Warning: Cannot modify header information - headers already sent by (output started at /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php:1) in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 130

Warning: Cannot modify header information - headers already sent by (output started at /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php:1) in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 131

Warning: Cannot modify header information - headers already sent by (output started at /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php:1) in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 132

Warning: Cannot modify header information - headers already sent by (output started at /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php:1) in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 133

Warning: Cannot modify header information - headers already sent by (output started at /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php:1) in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 134

Warning: Cannot modify header information - headers already sent by (output started at /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php:1) in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 135

Warning: Cannot modify header information - headers already sent by (output started at /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php:1) in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 547

Warning: Cannot modify header information - headers already sent by (output started at /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php:1) in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 548

Warning: Cannot modify header information - headers already sent by (output started at /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php:1) in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 549

Warning: Cannot modify header information - headers already sent by (output started at /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php:1) in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 550

Warning: Cannot modify header information - headers already sent by (output started at /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php:1) in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 551
namespace, '/' . $this->rest_base . '/status', array( array( 'methods' => \WP_REST_Server::READABLE, 'callback' => array( $this, 'get_status' ), 'permission_callback' => array( $this, 'permissions_check' ), ), 'schema' => array( $this, 'get_status_schema' ), ) ); register_rest_route( $this->namespace, '/' . $this->rest_base . '/trigger', array( array( 'methods' => \WP_REST_Server::CREATABLE, 'callback' => array( $this, 'trigger_import' ), 'permission_callback' => array( $this, 'permissions_check' ), ), 'schema' => array( $this, 'get_trigger_schema' ), ) ); register_rest_route( $this->namespace, '/' . $this->rest_base . '/retry-failed', array( array( 'methods' => \WP_REST_Server::CREATABLE, 'callback' => array( $this, 'retry_failed_imports' ), 'permission_callback' => array( $this, 'permissions_check' ), ), 'schema' => array( $this, 'get_retry_failed_schema' ), ) ); } /** * Check if a given request has access to analytics imports. * * @param \WP_REST_Request> $request Full details about the request. * @return WP_Error|boolean */ public function permissions_check( $request ) { if ( ! current_user_can( 'manage_woocommerce' ) ) { return new WP_Error( 'woocommerce_rest_cannot_access', __( 'Sorry, you cannot access analytics imports.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); } return true; } /** * Get the current import status. * * @param \WP_REST_Request> $request Full details about the request. * @return \WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. */ public function get_status( $request ) { $is_scheduled_mode = $this->is_scheduled_import_enabled(); $mode = $is_scheduled_mode ? 'scheduled' : 'immediate'; $failed_imports = OrdersScheduler::get_failed_order_imports(); $response = array( 'mode' => $mode, 'last_processed_date' => null, 'next_scheduled' => null, 'import_in_progress_or_due' => null, 'failed_count' => count( $failed_imports['ids'] ), 'failed_overflow_count' => $failed_imports['overflow'], ); // For scheduled mode, populate additional fields. if ( $is_scheduled_mode ) { $last_processed_gmt = get_option( OrdersScheduler::LAST_PROCESSED_ORDER_DATE_OPTION, null ); $response['last_processed_date'] = ( is_string( $last_processed_gmt ) && $last_processed_gmt ) ? get_date_from_gmt( $last_processed_gmt, 'Y-m-d H:i:s' ) : null; $response['next_scheduled'] = $this->get_next_scheduled_time(); $response['import_in_progress_or_due'] = $this->is_import_in_progress_or_due(); } return rest_ensure_response( $response ); } /** * Trigger a manual import. * * @param \WP_REST_Request> $request Full details about the request. * @return \WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. */ public function trigger_import( $request ) { $is_scheduled_mode = $this->is_scheduled_import_enabled(); // Return error if in immediate mode. if ( ! $is_scheduled_mode ) { return new WP_Error( 'woocommerce_rest_analytics_import_immediate_mode', __( 'Manual import is not available in immediate mode. Imports happen automatically.', 'woocommerce' ), array( 'status' => 400 ) ); } // Check if an import is already in progress or due to run soon. if ( $this->is_import_in_progress_or_due() ) { return new WP_Error( 'woocommerce_rest_analytics_import_in_progress', __( 'A batch import is already in progress or scheduled to run soon. Please wait for it to complete before triggering a new import.', 'woocommerce' ), array( 'status' => 400 ) ); } // Trigger the batch import immediately by rescheduling the recurring processor. // This unschedules the current recurring action and reschedules it to run now. $action_hook = OrdersScheduler::get_action( OrdersScheduler::PROCESS_PENDING_ORDERS_BATCH_ACTION ); if ( ! is_string( $action_hook ) ) { return new WP_Error( 'woocommerce_rest_analytics_import_invalid_action', __( 'Invalid action hook for batch import.', 'woocommerce' ), array( 'status' => 500 ) ); } WC()->queue()->cancel_all( $action_hook, array(), (string) OrdersScheduler::$group ); OrdersScheduler::schedule_recurring_batch_processor(); return rest_ensure_response( array( 'success' => true, 'message' => __( 'Batch import triggered successfully.', 'woocommerce' ), ) ); } /** * Re-schedule imports for orders that previously failed. * * Order IDs whose orders no longer exist are pruned (they can never import * successfully). Orders with an import already pending are skipped and * reported separately, so repeated requests don't claim to schedule new * work. The remaining IDs stay recorded until their import succeeds, so a * retry that fails again remains visible. * * @param \WP_REST_Request> $request Full details about the request. * @return \WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. */ public function retry_failed_imports( $request ) { $failed = OrdersScheduler::get_failed_order_imports(); if ( empty( $failed['ids'] ) ) { return new WP_Error( 'woocommerce_rest_analytics_no_failed_imports', __( 'There are no failed order imports to retry.', 'woocommerce' ), array( 'status' => 400 ) ); } $retried_count = 0; $pruned_count = 0; $already_scheduled_count = 0; $error_count = 0; foreach ( $failed['ids'] as $order_id ) { if ( ! wc_get_order( $order_id ) ) { OrdersScheduler::clear_failed_order_import( $order_id ); ++$pruned_count; continue; } // schedule_action() silently no-ops when the same import is // already pending, so check first to report an accurate count. if ( OrdersScheduler::has_existing_jobs( 'import', array( $order_id ) ) ) { ++$already_scheduled_count; continue; } try { OrdersScheduler::schedule_action( 'import', array( $order_id ) ); ++$retried_count; } catch ( \Throwable $e ) { // schedule_action() may run the import synchronously (e.g. when // Action Scheduler is unavailable); a failing order must not // abort the whole retry request. ++$error_count; wc_get_logger()->error( sprintf( 'Failed to schedule analytics re-import for order %d: %s', $order_id, $e->getMessage() ), array( 'source' => 'wc-analytics-order-import' ) ); } } // Nothing was scheduled and nothing is pending: surface the failure // instead of reporting success for work that didn't happen. if ( 0 === $retried_count && 0 === $already_scheduled_count && $error_count > 0 ) { return new WP_Error( 'woocommerce_rest_analytics_retry_failed', __( 'The failed orders could not be scheduled for re-import. Check the order import log for details.', 'woocommerce' ), array( 'status' => 500 ) ); } if ( $retried_count > 0 ) { $message = sprintf( /* translators: %d: number of orders scheduled for re-import */ _n( 'Re-import scheduled for %d order.', 'Re-import scheduled for %d orders.', $retried_count, 'woocommerce' ), $retried_count ); } elseif ( $already_scheduled_count > 0 ) { $message = __( 'Re-import is already scheduled for the previously failed orders.', 'woocommerce' ); } else { $message = __( 'No orders were scheduled for re-import. The previously failed orders no longer exist.', 'woocommerce' ); } if ( $error_count > 0 ) { $message .= ' ' . sprintf( /* translators: %d: number of orders that could not be scheduled for re-import */ _n( '%d order could not be scheduled. Check the order import log for details.', '%d orders could not be scheduled. Check the order import log for details.', $error_count, 'woocommerce' ), $error_count ); } return rest_ensure_response( array( 'success' => true, 'message' => $message, 'retried_count' => $retried_count, 'pruned_count' => $pruned_count, 'already_scheduled_count' => $already_scheduled_count, 'error_count' => $error_count, ) ); } /** * Get the schema for the retry-failed endpoint, conforming to JSON Schema. * * @return array */ public function get_retry_failed_schema() { $schema = array( '$schema' => 'https://json-schema.org/draft-04/schema#', 'title' => 'analytics_import_retry_failed', 'type' => 'object', 'properties' => array( 'success' => array( 'type' => 'boolean', 'description' => __( 'Whether the retry was scheduled successfully.', 'woocommerce' ), 'context' => array( 'view' ), 'readonly' => true, ), 'message' => array( 'type' => 'string', 'description' => __( 'Result message.', 'woocommerce' ), 'context' => array( 'view' ), 'readonly' => true, ), 'retried_count' => array( 'type' => 'integer', 'description' => __( 'Number of orders scheduled for re-import.', 'woocommerce' ), 'context' => array( 'view' ), 'readonly' => true, ), 'pruned_count' => array( 'type' => 'integer', 'description' => __( 'Number of failed records removed because their orders no longer exist.', 'woocommerce' ), 'context' => array( 'view' ), 'readonly' => true, ), 'already_scheduled_count' => array( 'type' => 'integer', 'description' => __( 'Number of orders skipped because their re-import is already pending.', 'woocommerce' ), 'context' => array( 'view' ), 'readonly' => true, ), 'error_count' => array( 'type' => 'integer', 'description' => __( 'Number of orders that could not be scheduled for re-import.', 'woocommerce' ), 'context' => array( 'view' ), 'readonly' => true, ), ), ); return $this->add_additional_fields_schema( $schema ); } /** * Check if scheduled import is enabled. * * Delegates to OrdersScheduler so the API reflects the same mode the * scheduler actually runs in (feature flag check + legacy option fallback). * * @return bool */ private function is_scheduled_import_enabled() { return OrdersScheduler::is_scheduled_import_enabled(); } /** * Get the next scheduled time for the batch processor. * * @return string|null Datetime string in site timezone or null if not scheduled. */ private function get_next_scheduled_time() { $action_hook = OrdersScheduler::get_action( OrdersScheduler::PROCESS_PENDING_ORDERS_BATCH_ACTION ); if ( ! is_string( $action_hook ) ) { return null; } $next_time = WC()->queue()->get_next( $action_hook, array(), (string) OrdersScheduler::$group ); if ( ! $next_time ) { return null; } // Convert UTC timestamp to site timezone. return get_date_from_gmt( $next_time->format( 'Y-m-d H:i:s' ), 'Y-m-d H:i:s' ); } /** * Get the schema for the status endpoint, conforming to JSON Schema. * * @return array */ public function get_status_schema() { $schema = array( '$schema' => 'https://json-schema.org/draft-04/schema#', 'title' => 'analytics_import_status', 'type' => 'object', 'properties' => array( 'mode' => array( 'type' => 'string', 'enum' => array( 'scheduled', 'immediate' ), 'description' => __( 'Current import mode.', 'woocommerce' ), 'context' => array( 'view' ), 'readonly' => true, ), 'last_processed_date' => array( 'type' => array( 'string', 'null' ), 'description' => __( 'Last processed order date (null in immediate mode).', 'woocommerce' ), 'context' => array( 'view' ), 'readonly' => true, ), 'next_scheduled' => array( 'type' => array( 'string', 'null' ), 'description' => __( 'Next scheduled import time (null in immediate mode).', 'woocommerce' ), 'context' => array( 'view' ), 'readonly' => true, ), 'import_in_progress_or_due' => array( 'type' => array( 'boolean', 'null' ), 'description' => __( 'Whether a batch import is currently running or scheduled to run within the next minute (null in immediate mode).', 'woocommerce' ), 'context' => array( 'view' ), 'readonly' => true, ), 'failed_count' => array( 'type' => 'integer', 'description' => __( 'Number of orders that failed analytics import and are pending retry.', 'woocommerce' ), 'context' => array( 'view' ), 'readonly' => true, ), 'failed_overflow_count' => array( 'type' => 'integer', 'description' => __( 'Number of failed order IDs dropped because the stored list reached its limit.', 'woocommerce' ), 'context' => array( 'view' ), 'readonly' => true, ), ), ); return $this->add_additional_fields_schema( $schema ); } /** * Get the schema for the trigger endpoint, conforming to JSON Schema. * * @return array */ public function get_trigger_schema() { $schema = array( '$schema' => 'https://json-schema.org/draft-04/schema#', 'title' => 'analytics_import_trigger', 'type' => 'object', 'properties' => array( 'success' => array( 'type' => 'boolean', 'description' => __( 'Whether the trigger was successful.', 'woocommerce' ), 'context' => array( 'view' ), 'readonly' => true, ), 'message' => array( 'type' => 'string', 'description' => __( 'Result message.', 'woocommerce' ), 'context' => array( 'view' ), 'readonly' => true, ), ), ); return $this->add_additional_fields_schema( $schema ); } /** * Check if a batch import is currently in progress or due to run soon. * * @return bool True if a batch import is in progress or scheduled to run within the next minute, false otherwise. */ private function is_import_in_progress_or_due() { $hook = OrdersScheduler::get_action( OrdersScheduler::PROCESS_PENDING_ORDERS_BATCH_ACTION ); if ( ! is_string( $hook ) ) { return false; } // Check for actions with 'in-progress' status. $in_progress_actions = WC()->queue()->search( array( 'hook' => $hook, 'status' => 'in-progress', 'per_page' => 1, ), 'ids' ); if ( ! empty( $in_progress_actions ) ) { return true; } // Check if the next scheduled import is due within 1 minute. $next_scheduled = WC()->queue()->get_next( $hook, array(), (string) OrdersScheduler::$group ); if ( $next_scheduled ) { $time_until_next = $next_scheduled->getTimestamp() - time(); // Consider it "due" if it's scheduled to run within the next 60 seconds. if ( $time_until_next <= MINUTE_IN_SECONDS ) { return true; } } return false; } }