• Модуль: iblock
  • Путь к файлу: ~/bitrix/modules/iblock/classes/general/iblockelement.php
  • Класс: CAllIBlockElement
  • Вызов: CAllIBlockElement::CounterInc
static function CounterInc($ID)
{
	global $DB;
	$ID = (int)$ID;
	if ($ID <= 0)
		return;
	if(!isset($_SESSION["IBLOCK_COUNTER"]) || !is_array($_SESSION["IBLOCK_COUNTER"]))
		$_SESSION["IBLOCK_COUNTER"] = array();
	if(in_array($ID, $_SESSION["IBLOCK_COUNTER"]))
		return;
	$_SESSION["IBLOCK_COUNTER"][] = $ID;

	$DB->StartUsingMasterOnly();
	$strSql =
		"UPDATE b_iblock_element SET ".
		"	TIMESTAMP_X = ".($DB->type=="ORACLE"?" NULL":"TIMESTAMP_X").", ".
		"	SHOW_COUNTER_START = ".$DB->IsNull("SHOW_COUNTER_START", $DB->CurrentTimeFunction()).", ".
		"	SHOW_COUNTER =  ".$DB->IsNull("SHOW_COUNTER", 0)." + 1 ".
		"WHERE ID=".$ID;
	$DB->Query($strSql, false, "", array("ignore_dml"=>true));
	$DB->StopUsingMasterOnly();
}