PluginProbe
ووسلام – همگام سازی ووکامرس و باسلام / 1.10.18
ووسلام – همگام سازی ووکامرس و باسلام v1.10.18
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 1.8.7 1.8.4 All 51 releases
sync-basalam / includes / Queue / Tasks / CreateProduct.php

CreateProduct.php in ووسلام – همگام سازی ووکامرس و باسلام 1.10.18, at includes/Queue/Tasks/CreateProduct.php

39 lines 840 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace SyncBasalam\Queue\Tasks;
4
5 use SyncBasalam\Admin\Product\ProductOperations;
6 use SyncBasalam\AsyncBackgroundProcess;
7
8 defined('ABSPATH') || exit;
9
10 class CreateProduct extends AsyncBackgroundProcess
11 {
12 protected $action = 'CreateSingleProduct';
13 protected $batch_size = 1;
14 private $operator;
15
16 public function __construct($operator = null)
17 {
18 parent::__construct();
19 $this->operator = $operator ?: syncBasalamContainer()->get(ProductOperations::class);
20 }
21
22 protected function task($item)
23 {
24 $this->operator->createNewProduct($item['id'], null);
25
26 return false;
27 }
28
29 protected function complete()
30 {
31 parent::complete();
32 }
33
34 public function isActive()
35 {
36 return get_site_transient($this->identifier . '_process_lock') !== false;
37 }
38 }
39