- Модуль: webdav
- Путь к файлу: ~/bitrix/modules/webdav/classes/iblock.php
- Класс: CWebDavIblock
- Вызов: CWebDavIblock::SetRootSection
function SetRootSection($id, $force=false, $enableRedirect = true)
{
$id = intval($id);
$this->CACHE_PATH = $this->cachePathBase;
$this->arRootSection = false;
if ($id <= 0)
{
return true;
}
if($force && isset(self::$arSectionCache[$id]))
{
unset(self::$arSectionCache[$id]);
}
if(isset(self::$arSectionCache[$id]))
{
$this->arRootSection = self::$arSectionCache[$id];
}
elseif(!$force)
{
$res = $this->GetCache($id, "root_section", true);
if($res["result"])
{
$this->arRootSection = $res["data"];
}
}
if($this->arRootSection === false)
{
$arFilter = array(
"IBLOCK_ID" => $this->IBLOCK_ID,
"ID" => $id,
"CHECK_PERMISSIONS" => "N"
);
$db_res = CIBlockSection::GetList(array(), $arFilter, false, array_merge(array('UF_USE_EXT_SERVICES'), self::getUFNamesForSectionLink()));
if ($db_res && $res = $db_res->Fetch())
{
//fixes
if (CModule::IncludeModule('socialnetwork'))
{
// fix an old bug, folder don't contain group name
if ($res['NAME'] == GetMessage("SONET_GROUP_PREFIX"))
{
$arGroup = CSocNetGroup::GetByID(intval($res['SOCNET_GROUP_ID']));
if($arGroup !== false)
{
$res['NAME'] = GetMessage("SONET_GROUP_PREFIX").$arGroup['NAME'];
$ibs = new CIBlockSection();
$ibs->Update($res['ID'], array('NAME' => $res['NAME']));
}
}
}
// fix incorrect iblock settings for socnet
if (!$this->_symlinkMode &&
IsModuleInstalled("bizproc") &&
(CIBlock::GetArrayByID($this->IBLOCK_ID, "BIZPROC") == "N")
)
{
$ib = new CIBlock;
$res = $ib->Update($this->IBLOCK_ID, array(
'BIZPROC' => 'Y',
'WORKFLOW' => 'N'
));
if($enableRedirect)
{
LocalRedirect($GLOBALS['APPLICATION']->GetCurPageParam());
}
}
//fixes end
$this->arRootSection = $res;
self::$arSectionCache[$id] = $res;
$arTags = array("iblock_id_" . $this->IBLOCK_ID);
$this->SetCache($id, "root_section", self::$arSectionCache[$id], $arTags, true);
}
else
{
return false;
}
}
$this->CACHE_PATH = $this->cachePathBase . intval($id).'/';
return true;
}