- Модуль: landing
- Путь к файлу: ~/bitrix/modules/landing/lib/site.php
- Класс: BitrixLandingSite
- Вызов: Site::onMainSiteDelete
static function onMainSiteDelete($siteId)
{
Rights::setOff();
$realSiteId = null;
// delete pages
$res = Landing::getList(array(
'select' => array(
'ID', 'SITE_ID'
),
'filter' => array(
'=SITE.SMN_SITE_ID' => $siteId,
'=SITE.DELETED' => ['Y', 'N'],
'=DELETED' => ['Y', 'N']
)
));
while ($row = $res->fetch())
{
$realSiteId = $row['SITE_ID'];
Landing::delete($row['ID'], true);
}
// detect site
if (!$realSiteId)
{
$res = self::getList(array(
'select' => array(
'ID'
),
'filter' => array(
'=SMN_SITE_ID' => $siteId,
'=DELETED' => ['Y', 'N']
)
));
if ($row = $res->fetch())
{
$realSiteId = $row['ID'];
}
}
// and delete site
if ($realSiteId)
{
self::delete($realSiteId);
}
Rights::setOn();
}