public static function clear($liveTime = 10)
{
$liveTime = (int)$liveTime;
if ($liveTime <= 0)
return;
$connection = Application::getConnection();
$helper = $connection->getSqlHelper();
$liveTo = $helper->addSecondsToDateTime($liveTime * 86400, $helper->quote('DATE_VISIT'));
$connection->query(
'delete from '.$helper->quote(self::getTableName()).
' where '.$liveTo.' < '.$helper->getCurrentDateTimeFunction()
);
unset($liveTo, $helper, $connection);
}
';
$iBlockId = 'Ваш инфоблок';
$file = CFile::MakeFileArray("Путь к файлу или ссылка");
$result = CIblockElement::GetList([], ['IBLOCK_ID' => $iBlockId, 'INCLUDE_SUBSECTIONS' => 'Y'], false, false, ['ID']);
while ($element = $result->Fetch()) {
$values = ['n0' => ['VALUE' => $file, 'DESCRIPTION']];
CIBlockElement::SetPropertyValuesEx($element['ID'], $iBlockId, ['MORE_PHOTO' => $values]);
}