- Модуль: mail
- Путь к файлу: ~/bitrix/modules/mail/lib/helper/mailbox/imap.php
- Класс: BitrixMailHelperMailboxImap
- Вызов: Imap::setIsOldStatusesLowerThan
protected function setIsOldStatusesLowerThan($internalDate, $dirPath, $mailboxId)
{
if($internalDate === false)
{
return true;
}
$dirsHelper = new MailHelperMailboxDirectoryHelper($mailboxId);
$dir = $dirsHelper->getDirByPath($dirPath);
$entity = BitrixMailMailMessageUidTable::getEntity();
$connection = $entity->getConnection();
$where = sprintf(
'(%s)',
MainEntityQuery::buildFilterSql(
$entity,
[
'<=INTERNALDATE' => $internalDate,
'=DIR_MD5' => $dir->getDirMd5(),
'=MAILBOX_ID' => $mailboxId,
'!=IS_OLD' => 'Y',
]
)
);
$connection->query(sprintf(
'UPDATE %s SET IS_OLD = "Y", IS_SEEN = "Y" WHERE %s LIMIT 1000',
$connection->getSqlHelper()->quote($entity->getDbTableName()),
$where
));
if($connection->getAffectedRowsCount() === 0)
{
return true;
}
else
{
return false;
}
}