32 if (!Loader::includeModule(self::$moduleId))
42 if (empty($queueOption))
48 $groupId = ($queueOption[
"groupId"] ?: 0);
49 $copiedGroupId = ($queueOption[
"copiedGroupId"] ?: 0);
50 $iblockTypeId = ($queueOption[
"iblockTypeId"] ?:
"");
51 $errorOffset = ($queueOption[
"errorOffset"] ?: 0);
54 $offset = $this->getOffset($iblockTypeId, $copiedGroupId) + $errorOffset;
56 $iblockIds = $this->getIblockIdsToCopy($iblockTypeId, $groupId);
57 $count = count($iblockIds);
58 $iblockIds = array_slice($iblockIds, $offset, $limit);
59 $features = ($queueOption[
"features"] ?: []);
63 $option[
"count"] = $count;
65 $copyManager =
new Manager($iblockTypeId, $iblockIds, $groupId);
66 $copyManager->setTargetLocation($iblockTypeId, $copiedGroupId);
67 $copyManager->setIblockImplementer(
new Iblock());
68 $copyManager->setFieldImplementer(
new Field());
69 $copyManager->setWorkflowImplementer(
new Workflow($iblockTypeId));
71 if (!in_array(
"field", $features))
73 $copyManager->removeFeature(
"field");
75 if (!in_array(
"section", $features))
77 $copyManager->removeFeature(
"section");
79 if (!in_array(
"element", $features))
81 $copyManager->removeFeature(
"element");
83 if (!in_array(
"workflow", $features))
85 $copyManager->removeFeature(
"workflow");
88 $result = $copyManager->startCopy();
89 if (!$result->isSuccess())
91 $queueOption[
"errorOffset"] += $this->getErrorOffset($copyManager);
95 $option[
"steps"] = $offset;
105 catch (\Exception $exception)
153 $queueId = (string) current($queue);
154 $this->checkerName = (mb_strpos($this->checkerName, $queueId) ===
false ?
156 $this->baseName = (mb_strpos($this->baseName, $queueId) ===
false ?
158 $this->errorName = (mb_strpos($this->errorName, $queueId) ===
false ?
183 $queueId = current($queue);
184 $currentPos = array_search($queueId, $queue);
185 if ($currentPos !==
false)
187 unset($queue[$currentPos]);
188 Option::set(static::$moduleId, $this->queueName, serialize($queue));