- Модуль: catalog
- Путь к файлу: ~/bitrix/modules/catalog/lib/subscribe.php
- Класс: BitrixCatalogSubscribeTable
- Вызов: SubscribeTable::runAgentToSendNotice
static function runAgentToSendNotice($productId)
{
$productId = (int)$productId;
if ($productId <= 0)
return false;
$connection = Application::getConnection();
$helper = $connection->getSqlHelper();
$connection->queryExecute('update '.$helper->quote(static::getTableName()).' set '
.$helper->quote('NEED_SENDING').' = 'Y' where '.$helper->quote('ITEM_ID').' = '.$productId
.' and ('.$helper->quote('DATE_TO').' is null or '.$helper->quote('DATE_TO').' > '
.$helper->getCurrentDateTimeFunction().')'
);
if (!static::$agentNoticeCreated)
{
$t = DateTime::createFromTimestamp(time() + static::AGENT_TIME_OUT);
static::$agentNoticeCreated = true;
CAgent::AddAgent(
'BitrixCatalogSubscribeTable::sendNotice();',
'catalog',
'N',
static::AGENT_INTERVAL,
'',
'Y',
$t->toString(),
100,
false,
false
);
}
return true;
}