- Модуль: webdav
- Путь к файлу: ~/bitrix/modules/webdav/classes/iblock.php
- Класс: CWebDavIblock
- Вызов: CWebDavIblock::_delete_section
function _delete_section($sectionID)
{
static $onDeleteEventSet = false;
$result = true;
if ($onDeleteEventSet == false && ($this->workflow == 'bizproc' || $this->workflow == 'bizproc_limited'))
{
AddEventHandler("iblock", "OnBeforeIBlockElementDelete", Array($this, "_onDeleteElement"));
AddEventHandler("iblock", "OnBeforeIBlockSectionDelete", Array($this, "_onDeleteSection"));
}
$arSections = array();
$sectionID = intval($sectionID);
$s = CIBlockSection::GetList(array(),
array(
"ID" => $sectionID,
'CHECK_PERMISSIONS' => 'N'
),
false,
array('ID', 'NAME', 'LEFT_MARGIN', 'RIGHT_MARGIN', 'DEPTH_LEVEL', 'IBLOCK_ID')
);
if ($arParentSection = $s->Fetch())
{
CWebDavSymlinkHelper::setSectionOriginalName($sectionID, $arParentSection['NAME']);
if (! $this->GetPermission('SECTION', $sectionID, 'section_delete', false)) // check perms on target folder
{
$result = GetMessage('WD_ERR_DELETE_FOLDER_NO_PERMS', array(
'ID' => $sectionID, //$arSection['ID'],
'NAME' => "", //htmlspecialcharsbx($arSection['NAME'])
));
}
else
{
$arSections[] = $sectionID;
$rSection = CIBlockSection::GetList( // get all subsections
array('LEFT_MARGIN' => 'DESC'),
array(
'CHECK_PERMISSIONS' => 'N',
'IBLOCK_ID' => $arParentSection['IBLOCK_ID'],
'>LEFT_MARGIN' => $arParentSection['LEFT_MARGIN'],
' $arParentSection['RIGHT_MARGIN'],
'>DEPTH_LEVEL' => $arParentSection['DEPTH_LEVEL']
),
false,
array('ID', 'NAME')
);
if ($rSection)
{
while ($arSection = $rSection->Fetch())
{
if (! $this->GetPermission('SECTION', $arSection['ID'], 'section_delete')) // check perms on subsection
{
$result = GetMessage('WD_ERR_DELETE_FOLDER_NO_PERMS', array(
'ID' => $arSection['ID'],
'NAME' => htmlspecialcharsbx($arSection['NAME'])
));
break;
}
else
{
$arSections[] = $arSection['ID'];
}
}
}
}
if ($result === true) // no errors
{
$se = new CIBlockSection();
if (!$se->Delete($arParentSection['ID'], false)) // delete each section in separate transaction
{
$result = GetMessage('WD_FILE_ERROR16');
}
}
}
return (($result === true) ? $result : $this->ThrowError("423 Locked", "423", $result));
}