• Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/internals/counter/processor/projectprocessor.php
  • Класс: BitrixTasksInternalsCounterProcessorProjectProcessor
  • Вызов: ProjectProcessor::readAll
public function readAll(int $userId = 0, array $groupIds = [])
{
	$where = [];

	if ($userId)
	{
		$where[] = '`USER_ID` = ' . $userId;
	}

	if (!empty($groupIds))
	{
		$where[] = "GROUP_ID IN (". implode(",", $groupIds) .")";
	}
	else
	{
		$where[] = "GROUP_ID > 0";
	}

	$types = array_merge(
		array_values(CounterDictionary::MAP_COMMENTS),
		array_values(CounterDictionary::MAP_MUTED_COMMENTS),
		[CounterDictionary::COUNTER_GROUP_COMMENTS]
	);
	$where[] = "`TYPE` IN ('". implode("','", $types) ."')";

	$where = (!empty($where)) ? ('WHERE ' . implode(' AND ', $where)) : '';

	$sql = "
		DELETE
		FROM ". CounterTable::getTableName(). "
		{$where}
	";

	Application::getConnection()->query($sql);
}