- Модуль: landing
- Путь к файлу: ~/bitrix/modules/landing/lib/copy/integration/group.php
- Класс: BitrixLandingCopyIntegrationGroup
- Вызов: Group::copy
public function copy($groupId, $copiedGroupId)
{
Hook::setEditMode();
LandingSiteType::setScope(LandingSiteType::SCOPE_CODE_GROUP);
$binder = LandingConnectorSocialNetwork::getBindingRow($groupId);
if (!$binder)
{
return;
}
$siteId = (int) $binder['ENTITY_ID'];
$addSiteResult = LandingSite::copy($siteId);
if (!$addSiteResult->isSuccess())
{
return;
}
/** @var AddResult $addSiteResult */
$copiedSiteId = (int) $addSiteResult->getId();
// copy folders
$folderMapIds = [];
LandingSite::copyFolders($siteId, $copiedSiteId, $folderMapIds);
$folderIndexIds = [];
$res = Folder::getList([
'select' => [
'ID', 'INDEX_ID'
],
'filter' => [
'SITE_ID' => $siteId,
'!INDEX_ID' => null
]
]);
while ($row = $res->fetch())
{
$folderIndexIds[$row['ID']] = $row['INDEX_ID'];
}
$this->addToQueue($copiedGroupId);
Option::set(self::MODULE_ID, self::CHECKER_OPTION.$copiedGroupId, "Y");
$dataToCopy = [
"executiveUserId" => $this->executiveUserId,
"groupId" => $groupId,
"copiedGroupId" => $copiedGroupId,
"siteId" => $siteId,
"copiedSiteId" => $copiedSiteId,
"folderMapIds" => $folderMapIds,
"folderIndexIds" => $folderIndexIds
];
Option::set(self::MODULE_ID, self::STEPPER_OPTION.$copiedGroupId, serialize($dataToCopy));
GroupStepper::bind(1);
$binder = new LandingBindingGroup($copiedGroupId);
$binder->bindSite($copiedSiteId);
}