- Модуль: main
- Путь к файлу: ~/bitrix/modules/main/classes/general/component.php
- Класс: CBitrixComponent
- Вызов: CBitrixComponent::endResultCache
public function endResultCache()
{
global $NavNum, $CACHE_MANAGER;
if (!$this->__bInited)
return null;
if (!$this->__cache)
{
if ($this->__parent)
{
foreach ($this->__children_css as $cssPath)
{
$this->__parent->addChildCSS($cssPath);
}
foreach ($this->__children_js as $jsPath)
{
$this->__parent->addChildJS($jsPath);
}
foreach ($this->__children_epilogs as $epilogFile)
{
$this->__parent->addChildEpilog($epilogFile);
}
foreach ($this->__children_frames as $frame)
{
$this->__parent->addChildFrame($frame);
}
}
return null;
}
$arCache = array(
"arResult" => $this->arResult,
);
if ($this->__template)
{
$arCache["templateCachedData"] = $this->__template->getCachedData();
if ($this->__component_epilog)
$arCache["templateCachedData"]["component_epilog"] = $this->__component_epilog;
}
else
{
$arCache["templateCachedData"] = array();
}
if (($this->__NavNum !== false) && ($this->__NavNum !== $NavNum))
{
$arCache["templateCachedData"]["__NavNum"] = $NavNum - $this->__NavNum;
}
$currentCountersDiff = array();
foreach (self::$__componentCounter as $componentName => $counter)
{
if (array_key_exists($componentName, $this->__currentCounters))
{
if (self::$__componentCounter[$componentName] > $this->__currentCounters[$componentName])
{
$currentCountersDiff[$componentName] =
self::$__componentCounter[$componentName] - $this->__currentCounters[$componentName];
}
}
else
{
$currentCountersDiff[$componentName] = self::$__componentCounter[$componentName];
}
}
if (!empty($currentCountersDiff))
{
$arCache["templateCachedData"]["__currentCounters"] = $currentCountersDiff;
}
if (!empty($this->__children_css))
{
$arCache["templateCachedData"]["__children_css"] = $this->__children_css;
if ($this->__parent)
{
foreach($this->__children_css as $cssPath)
$this->__parent->addChildCSS($cssPath);
}
}
if (!empty($this->__children_js))
{
$arCache["templateCachedData"]["__children_js"] = $this->__children_js;
if ($this->__parent)
{
foreach($this->__children_js as $jsPath)
$this->__parent->addChildJS($jsPath);
}
}
if (!empty($this->__children_epilogs))
{
$arCache["templateCachedData"]["__children_epilogs"] = $this->__children_epilogs;
if ($this->__parent)
{
foreach($this->__children_epilogs as $epilogFile)
$this->__parent->addChildEpilog($epilogFile);
}
}
if (!empty($this->__children_frames))
{
$arCache["templateCachedData"]["__children_frames"] =
array_map(
function($frame) {
return $frame->getCachedData();
},
$this->__children_frames
);
if ($this->__parent)
{
foreach ($this->__children_frames as $frame)
{
$this->__parent->addChildFrame($frame);
}
}
}
if (!empty($this->__view))
$arCache["templateCachedData"]["__view"] = $this->__view;
if (!empty($this->__editButtons))
$arCache["templateCachedData"]["__editButtons"] = $this->__editButtons;
$cacheWasStarted = $this->__cache->isStarted();
$this->__cache->endDataCache($arCache);
if (defined("BX_COMP_MANAGED_CACHE") && $cacheWasStarted)
$CACHE_MANAGER->endTagCache();
$this->__cache = null;
}