3namespace Bitrix\Socialnetwork\Internals\LiveFeed\Counter\Processor;
5use Bitrix\Socialnetwork\Internals\LiveFeed\Counter\Exception\UnknownCounterException;
6use Bitrix\Socialnetwork\Internals\LiveFeed\Counter;
7use Bitrix\Socialnetwork\Internals\LiveFeed\Counter\Queue\Queue;
8use Bitrix\Socialnetwork\Internals\LiveFeed\Counter\Queue\Agent;
9use Bitrix\Socialnetwork\Internals\LiveFeed\Counter\Collector;
10use Bitrix\Socialnetwork\Internals\LiveFeed\Counter\CounterDictionary;
11use Bitrix\Socialnetwork\Internals\LiveFeed\Counter\CounterController;
12use Bitrix\Socialnetwork\Item\Log;
13use Bitrix\Socialnetwork\UserContentViewTable;
23 private array|
null $userSonetLogs =
null;
25 private static array $instances = [];
29 if (!array_key_exists($userId, self::$instances))
31 self::$instances[$userId] =
new self($userId);
34 return self::$instances[$userId];
37 private function __construct(
int $userId)
42 public function readAll(
int $groupId = 0): void
49 $itemsToReset = $this->getSonetLogItemsByGroup($groupId);
51 self::reset($this->userId, $types, $itemsToReset);
62 $total = $this->getSonetLogCollector()->fetchTotal();
67 $rows = $this->getSonetLogCollector()->fetch($limit, $offset);
71 (
new Agent())->addAgent();
84 self::reset($this->userId, $counterTypes, $logIds);
100 self::reset($this->userId, $counterTypes, $logIds);
115 self::reset($this->userId, $counterTypes, $logIds);
121 private function addToQueue(
string $counter,
array $logIds): void
126 private function getUserCollector():
Collector\UserCollector
128 if (!$this->userCollector)
132 return $this->userCollector;
135 private function getSonetLogCollector(): Collector\SonetLogCollector
137 if (!$this->sonetLogCollector)
139 $this->sonetLogCollector = Collector\SonetLogCollector::getInstance($this->userId);
141 return $this->sonetLogCollector;
144 private function getSonetLogItemsByGroup(
int $groupId):
array
148 foreach (Counter\State\Factory::getState($this->userId) as $item)
150 if ($item[
'GROUP_ID'] == $groupId)
152 $items[] = $item[
'SONET_LOG_ID'];
if(!is_object($USER)||! $USER->IsAuthorized()) $userId
static getInstance(int $userId)
const COUNTER_NEW_COMMENTS
recount(string $counter, array $logIds=[])
recountAll(string $counter)
static getInstance(int $userId)
add(string $counter, array $logIds=[])
seen(string $counter, array $logIds=[])
static getState(int $userId)
static reloadState(int $userId)
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)