• Модуль: messageservice
  • Путь к файлу: ~/bitrix/modules/messageservice/lib/queue.php
  • Класс: BitrixMessageServiceQueue
  • Вызов: Queue::cleanUpAgent
static function cleanUpAgent()
{
	$period = abs(intval(ConfigOption::get("messageservice", "clean_up_period", 14)));
	$periodInSeconds = $period * 24 * 3600;

	if ($periodInSeconds > 0)
	{
		$connection = BitrixMainApplication::getConnection();
		$datetime = $connection->getSqlHelper()->addSecondsToDateTime('-' . $periodInSeconds);

		$strSql = "DELETE FROM b_messageservice_message WHERE DATE_EXEC <= " . $datetime ;
		$connection->query($strSql);
	}
	return "BitrixMessageServiceQueue::cleanUpAgent();";
}