- Модуль: statistic
- Путь к файлу: ~/bitrix/modules/statistic/classes/mysql/statistic.php
- Класс: CStatistics
- Вызов: CStatistics::SetNewDay
static function SetNewDay($HOSTS=0, $TOTAL_HOSTS=0, $SESSIONS=0, $HITS=0, $NEW_GUESTS=0, $GUESTS=0, $FAVORITES=0)
{
__SetNoKeepStatistics();
if ($_SESSION["SESS_NO_AGENT_STATISTIC"]!="Y" && !defined("NO_AGENT_STATISTIC"))
{
$err_mess = "File: ".__FILE__."
Line: ";
$DB = CDatabase::GetModuleConnection('statistic');
$strSql = "SELECT D.ID FROM b_stat_day D WHERE D.DATE_STAT=CURDATE()";
$rs = $DB->Query($strSql, false, $err_mess.__LINE__);
if(!$rs->Fetch())
{
$arFields = Array(
"DATE_STAT" => "curdate()",
"C_HOSTS" => intval($HOSTS),
"SESSIONS" => intval($SESSIONS),
"GUESTS" => intval($GUESTS),
"HITS" => intval($HITS),
"FAVORITES" => intval($FAVORITES),
"NEW_GUESTS" => intval($NEW_GUESTS),
);
$ID = $DB->Insert("b_stat_day", $arFields, $err_mess.__LINE__, false, "", true);
}
//Calculate attentiveness for yesturday
$strSql = "
SELECT D.ID, ".$DB->DateToCharFunction("D.DATE_STAT","SHORT")." DATE_STAT
FROM b_stat_day D
WHERE D.DATE_STAT=DATE_SUB(CURDATE(),INTERVAL 1 DAY)
";
$rs = $DB->Query($strSql, false, $err_mess.__LINE__);
if($ar=$rs->Fetch())
{
$arF = CSession::GetAttentiveness($ar["DATE_STAT"]);
if (is_array($arF)) $DB->Update("b_stat_day",$arF,"WHERE ID='".$ar["ID"]."'",$err_mess.__LINE__);
}
}
return "CStatistics::SetNewDay();";
}