21 private $executiveUserId;
22 private $features = [];
24 public function __construct($executiveUserId = 0, array $features = [])
26 $this->executiveUserId = $executiveUserId;
27 $this->features = $features;
36 public function copy($groupId, $copiedGroupId)
39 Landing\Site\Type::setScope(
Landing\
Site\Type::SCOPE_CODE_GROUP);
40 $binder = Landing\Connector\SocialNetwork::getBindingRow($groupId);
46 $siteId = (int) $binder[
'ENTITY_ID'];
48 $addSiteResult = Landing\Site::copy($siteId);
49 if (!$addSiteResult->isSuccess())
54 $copiedSiteId = (int) $addSiteResult->getId();
58 Landing\Site::copyFolders($siteId, $copiedSiteId, $folderMapIds);
61 $res = Folder::getList([
70 while ($row = $res->fetch())
72 $folderIndexIds[$row[
'ID']] = $row[
'INDEX_ID'];
75 $this->addToQueue($copiedGroupId);
77 Option::set(self::MODULE_ID, self::CHECKER_OPTION.$copiedGroupId,
"Y");
80 "executiveUserId" => $this->executiveUserId,
81 "groupId" => $groupId,
82 "copiedGroupId" => $copiedGroupId,
84 "copiedSiteId" => $copiedSiteId,
85 "folderMapIds" => $folderMapIds,
86 "folderIndexIds" => $folderIndexIds
88 Option::set(self::MODULE_ID, self::STEPPER_OPTION.$copiedGroupId, serialize($dataToCopy));
90 GroupStepper::bind(1);
93 if (!$binder->isForbiddenBindingAction())
95 $binder->bindSite($copiedSiteId);
99 private function addToQueue(
int $copiedGroupId)
101 $option = Option::get(self::MODULE_ID, self::QUEUE_OPTION,
"");
102 $option = ($option !==
"" ? unserialize($option, [
'allowed_classes' =>
false]) : []);
103 $option = (is_array($option) ? $option : []);
105 $option[] = $copiedGroupId;
106 Option::set(self::MODULE_ID, self::QUEUE_OPTION, serialize($option));