CCrmWebDavHelper::ResolveSharedFileIBlockID

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. CCrmWebDavHelper
  4. ResolveSharedFileIBlockID
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/classes/general/crm_webdav_helper.php
  • Класс: \CCrmWebDavHelper
  • Вызов: CCrmWebDavHelper::ResolveSharedFileIBlockID
static function ResolveSharedFileIBlockID($siteID = SITE_ID)
{
	$siteID = strval($siteID);
	if($siteID === '')
	{
		return 0;
	}

	if(!isset(self::$SHARED_FILES_INFO[$siteID]))
	{
		self::$SHARED_FILES_INFO[$siteID] = array();
	}
	$info = self::$SHARED_FILES_INFO[$siteID];

	$blockID = 0;
	if(isset($info['IBLOCK_ID']))
	{
		$blockID = $info['IBLOCK_ID'];
	}
	else
	{
		$sharedFilesSettings = unserialize(COption::GetOptionString('webdav', 'shared_files', ''), ['allowed_classes' => false]);
		if(isset($sharedFilesSettings[$siteID]))
		{
			$siteSettings = $sharedFilesSettings[$siteID];
			$blockID = isset($siteSettings['id']) ? intval($siteSettings['id']) : 0;
		}

		if($blockID <= 0)
		{
			$dbIBlock = CIBlock::GetList(array(), array('XML_ID' => "shared_files_{$siteID}", 'TYPE' => 'library'));
			if ($arIBlock = $dbIBlock->Fetch())
			{
				$blockID = $arIBlock['ID'];
			}
		}

		self::$SHARED_FILES_INFO[$siteID]['IBLOCK_ID'] = $blockID;
	}

	return $blockID;
}

Добавить комментарий