• Модуль: sender
  • Путь к файлу: ~/bitrix/modules/sender/lib/internals/countercalculation.php
  • Класс: Bitrix\Sender\Internals\CounterCalculation
  • Вызов: CounterCalculation::update
static function update()
{
	if(self::wasCompleted())
	{
		return false;
	}

	$haveData = false;

	// update reading counters of recipients
	foreach(array('READ', 'CLICK', 'UNSUB') as $type)
	{
		if($haveData || self::wasCompleted('RECIPIENT_' . $type))
		{
			continue;
		}

		$haveData = self::updateRecipientReadCounters($type);
		if(!$haveData)
		{
			self::setCompleted('RECIPIENT_' . $type);
		}
	}

	// update status counters of posting
	if(!$haveData && !self::wasCompleted('POSTING_STATUS'))
	{
		$haveData = self::updatePostingStatusCounters();
		if(!$haveData)
		{
			self::setCompleted('POSTING_STATUS');
		}
	}

	// update reading counters of posting
	foreach(array('READ', 'CLICK', 'UNSUB') as $type)
	{
		if($haveData || self::wasCompleted('POSTING_' . $type))
		{
			continue;
		}

		$haveData = self::updatePostingReadCounters($type);
		if(!$haveData)
		{
			self::setCompleted('POSTING_' . $type);
		}
	}

	// update status counters of posting
	if(!$haveData && !self::wasCompleted('MAILING_SUBSCRIPTION'))
	{
		$haveData = self::updateMailingSubscription();
		if(!$haveData)
		{
			self::setCompleted('MAILING_SUBSCRIPTION');
		}
	}

	// update contact email register
	if(!$haveData && !self::wasCompleted('CONTACT_EMAIL_REGISTER'))
	{
		$haveData = self::updateContactEmailRegister();
		if(!$haveData)
		{
			self::setCompleted('CONTACT_EMAIL_REGISTER');
		}
	}

	// if all processed set done flag
	if(!$haveData)
	{
		self::setCompleted();
	}

	return $haveData;
}