- Модуль: pull
- Путь к файлу: ~/bitrix/modules/pull/classes/general/pull_watch.php
- Класс: CAllPullWatch
- Вызов: CAllPullWatch::Extend
static function Extend($userId, $tags)
{
global $DB, $CACHE_MANAGER;
if (intval($userId) == 0)
{
return false;
}
if (is_array($tags))
{
$isMulti = true;
$searchTag = '';
if (empty($tags))
{
return false;
}
}
else
{
$isMulti = false;
$searchTag = trim($tags);
if ($searchTag == '')
{
return false;
}
else
{
$tags = Array($searchTag);
}
}
$result = Array();
foreach ($tags as $id => $tag)
{
$result[$tag] = false;
$tags[$id] = $DB->ForSQL($tag);
}
$updateIds = Array();
$strSql = "SELECT ID, TAG FROM b_pull_watch WHERE USER_ID = ".intval($userId)." AND TAG IN ('".implode("', '", $tags)."')";
$dbRes = $DB->Query($strSql, false, "File: ".__FILE__."
Line: ".__LINE__);
while ($arRes = $dbRes->Fetch())
{
$updateIds[] = $arRes['ID'];
$result[$arRes['TAG']] = true;
}
if ($updateIds)
{
$DB->Query("UPDATE b_pull_watch SET DATE_CREATE = ".$DB->CurrentTimeFunction()." WHERE ID IN (".implode(', ', $updateIds).")");
$CACHE_MANAGER->Clean("b_pw_".$userId, "b_pull_watch");
}
return $isMulti? $result: $result[$searchTag];
}