PluginProbe
ووسلام – همگام سازی ووکامرس و باسلام / 1.10.6
ووسلام – همگام سازی ووکامرس و باسلام v1.10.6
1.10.19 1.10.20 1.10.18 1.10.17 1.10.15 1.10.14 1.10.13 1.10.12 1.10.10 1.10.9 1.10.8 1.10.7 1.10.6 1.10.5 1.10.4 1.10.3 1.10.2 1.10.1 1.10.0 1.9.2 1.9.1 1.9.0 1.8.8 1.8.5 1.8.6 All 53 releases
sync-basalam / includes / Actions / Controller / ProductActions / CancelCreateProducts.php

CancelCreateProducts.php in ووسلام – همگام سازی ووکامرس و باسلام 1.10.6, at includes/Actions/Controller/ProductActions/CancelCreateProducts.php

42 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace SyncBasalam\Actions\Controller\ProductActions;
4
5 use SyncBasalam\JobManager;
6 use SyncBasalam\Actions\Controller\ActionController;
7
8 defined('ABSPATH') || exit;
9
10 class CancelCreateProducts extends ActionController
11 {
12 public function __invoke()
13 {
14 $jobManager = syncBasalamContainer()->get(JobManager::class);
15
16 $jobTypes = [
17 'sync_basalam_create_single_product',
18 'sync_basalam_create_all_products',
19 ];
20
21 $deletedCount = 0;
22 foreach ($jobTypes as $jobType) {
23 $result = $jobManager->deleteJob([
24 'job_type' => $jobType,
25 'status' => 'pending',
26 ]);
27 if ($result) {
28 $deletedCount += $result;
29 }
30
31 $result = $jobManager->deleteJob([
32 'job_type' => $jobType,
33 'status' => 'processing',
34 ]);
35 if ($result) {
36 $deletedCount += $result;
37 }
38 }
39 delete_option('sync_basalam_last_creatable_product_id');
40 }
41 }
42