PluginProbe
seQura / 4.1.0
seQura v4.1.0
4.3.4 4.3.3 4.3.2 4.3.1 trunk 2.0.0 2.0.10 2.0.11 2.0.12 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 3.0.0 3.0.2 3.0.5 3.0.6 3.0.7 3.1.0 3.1.1 3.2.0 3.2.1 3.2.2 4.0.0 All 30 releases
← All changes | src/Controllers/Hooks/Order/class-order-controller.php +30 -3 3.0.74.1.0 View file →
@@ -9,9 +9,9 @@
9 9 namespace SeQura\WC\Controllers\Hooks\Order;
10 10
11 11 use SeQura\Core\Infrastructure\Logger\LogContextData;
12 12 use SeQura\WC\Controllers\Controller;
13 -use SeQura\WC\Services\Interface_Logger_Service;
13 +use SeQura\WC\Services\Log\Interface_Logger_Service;
14 14 use SeQura\WC\Services\Order\Interface_Order_Service;
15 15 use Throwable;
16 16 use WC_Order;
17 17
@@ -32,9 +32,9 @@
32 32 */
33 33 public function __construct(
34 34 Interface_Logger_Service $logger,
35 35 string $templates_path,
36 - Interface_Order_Service $order_service
36 + Interface_Order_Service $order_service
37 37 ) {
38 38 parent::__construct( $logger, $templates_path );
39 39 $this->order_service = $order_service;
40 40
@@ -98,9 +98,9 @@
98 98 \set_transient(
99 99 $this->get_notices_transient( $order_id ),
100 100 array(
101 101 array(
102 - 'notice' => \__( 'An error occurred while updating the order data in seQura.', 'sequra' ), // TODO: improve message with link to simba.
102 + 'notice' => __( 'An error occurred while updating the order data in seQura.', 'sequra' ), // TODO: improve message with link to simba.
103 103 'type' => 'error',
104 104 'dismissible' => true,
105 105 ),
106 106 ),
@@ -156,6 +156,33 @@
156 156 $args = array(
157 157 'sequra_link' => $this->order_service->get_link_to_sequra_back_office( $order ),
158 158 );
159 159 \wc_get_template( 'admin/order_details.php', $args, '', $this->templates_path );
160 + }
161 +
162 + /**
163 + * Cleanup orders
164 + *
165 + * @return void
166 + */
167 + public function cleanup_orders() {
168 + $this->logger->log_debug( 'Hook executed', __FUNCTION__, __CLASS__ );
169 + $this->order_service->cleanup_orders();
170 + }
171 +
172 + /**
173 + * Respond to the sequra_order_migration_add_indexes hook
174 + *
175 + * @param string $hook Hook name that triggered the action.
176 + */
177 + public function migrate_orders_to_use_indexes( $hook ) {
178 + $this->logger->log_debug( 'Hook executed', __FUNCTION__, __CLASS__ );
179 +
180 + if ( $this->order_service->is_migration_complete() ) {
181 + $this->logger->log_debug( 'Indexing process is done. Job will be unscheduled', __FUNCTION__, __CLASS__ );
182 + \wp_clear_scheduled_hook( $hook, array( $hook ) );
183 + return;
184 + }
185 +
186 + $this->order_service->migrate_data();
160 187 }
161 188 }