- Модуль: blog
- Путь к файлу: ~/bitrix/modules/blog/lib/broadcast.php
- Класс: BitrixBlogBroadcast
- Вызов: Broadcast::getCount
static function getCount($period): int
{
$counter = 0;
$now = new DateTime();
$res = PostTable::getList([
'order' => [],
'filter' => [
'=PostSocnetRights:POST.ENTITY' => 'G2',
'=PUBLISH_STATUS' => BLOG_PUBLISH_STATUS_PUBLISH,
'>DATE_PUBLISH' => DateTime::createFromUserTime(DateTime::createFromUserTime($now->sub(new DateInterval($period))->format(DateTime::getFormat()))),
],
'group' => [],
'select' => [ 'CNT' ],
'runtime' => [
new ExpressionField('CNT', 'COUNT(*)'),
],
'data_doubling' => false,
]);
while ($ar = $res->fetch())
{
$counter = (int)$ar['CNT'];
}
return $counter;
}