- Модуль: tasks
- Путь к файлу: ~/bitrix/modules/tasks/lib/update/fulltasksindexer.php
- Класс: BitrixTasksUpdateFullTasksIndexer
- Вызов: FullTasksIndexer::fillSourceParams
static function fillSourceParams(): array
{
$tasksRes = TaskTable::getList([
'select' => ['ID'],
'order' => ['ID' => 'ASC'],
'count_total' => true,
]);
$tasks = $tasksRes->fetchAll();
$count = $tasksRes->getCount();
reset($tasks);
$lastTask = end($tasks);
$lastTaskToIndex = (int)$lastTask['ID'];
if (static::checkForumIncluded())
{
$query = new Query(TaskTable::getEntity());
$query->setSelect([new ExpressionField('CNT', 'COUNT(*)')]);
$query->registerRuntimeField(
'',
new ReferenceField(
'FM',
MessageTable::class,
Join::on('this.FORUM_TOPIC_ID', 'ref.TOPIC_ID')
->where('ref.NEW_TOPIC', 'N'),
['join_type' => 'INNER']
)
);
$commentsCountRes = $query->exec();
if ($commentsCount = $commentsCountRes->fetch())
{
$count += (int)$commentsCount['CNT'];
}
}
return [
'number' => 0,
'last_task_id' => 0,
'last_task_to_index' => $lastTaskToIndex,
'last_comment_id' => 0,
'count' => $count,
];
}