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 +19 -2 3.1.14.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
@@ -166,6 +166,23 @@
166 166 */
167 167 public function cleanup_orders() {
168 168 $this->logger->log_debug( 'Hook executed', __FUNCTION__, __CLASS__ );
169 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();
170 187 }
171 188 }