- Модуль: tasks
- Путь к файлу: ~/bitrix/modules/tasks/lib/integration/socialnetwork/logdestination.php
- Класс: BitrixTasksIntegrationSocialNetworkLogDestination
- Вызов: LogDestination::fillProjects
private function fillProjects(): self
{
$userId = User::getId();
$cacheTtl = defined("BX_COMP_MANAGED_CACHE") ? 3153600 : 3600*4;
$cacheId = "dest_project_".$userId.md5(serialize($this->parameters)).SITE_ID;
$cacheDir = "/tasks/dest/".$userId;
$cache = new CPHPCache;
if($cache->initCache($cacheTtl, $cacheId, $cacheDir))
{
$this->fillProjectsFromCache($cache);
return $this;
}
$cache->startDataCache();
$limitReached = false;
$this->destination["SONETGROUPS"] = CSocNetLogDestination::getSocnetGroup(array_merge($this->destinationParams, array(
"ALL" => "Y",
"GROUP_CLOSED" => "N",
"features" => array(
"tasks", array("create_tasks")
)
)), $limitReached);
if (isset($this->destination['SONETGROUPS']['PROJECTS']))
{
$this->destination['PROJECTS'] = $this->destination['SONETGROUPS']['PROJECTS'];
}
if (isset($this->destination['SONETGROUPS']['SONETGROUPS']))
{
$this->destination['SONETGROUPS'] = $this->destination['SONETGROUPS']['SONETGROUPS'];
}
$this->destination["SONETGROUPS_LIMITED"] = ($limitReached ? 'Y' : 'N');
if(defined("BX_COMP_MANAGED_CACHE"))
{
global $CACHE_MANAGER;
$CACHE_MANAGER->startTagCache($cacheDir);
$CACHE_MANAGER->registerTag("sonet_group");
foreach($this->destination["SONETGROUPS"] as $val)
{
$CACHE_MANAGER->registerTag("sonet_features_G_".$val["entityId"]);
$CACHE_MANAGER->registerTag("sonet_group_".$val["entityId"]);
}
if (!empty($this->destination['PROJECTS']))
{
foreach($this->destination["PROJECTS"] as $val)
{
$CACHE_MANAGER->registerTag("sonet_features_G_".$val["entityId"]);
$CACHE_MANAGER->registerTag("sonet_group_".$val["entityId"]);
}
}
$CACHE_MANAGER->registerTag("sonet_user2group_U".$userId);
$CACHE_MANAGER->endTagCache();
}
$cache->endDataCache(array(
"SONETGROUPS" => $this->destination["SONETGROUPS"],
"PROJECTS" => ($this->destination["PROJECTS"] ?? null),
"SONETGROUPS_LIMITED" => $this->destination["SONETGROUPS_LIMITED"]
));
return $this;
}