mirror of
https://github.com/Mibew/tray.git
synced 2025-01-22 18:10:34 +03:00
Added 'visitedpageststistics' table and fixed the bug, related to remove visitors' path during chat time
This commit is contained in:
parent
1f4582ab20
commit
5f71deeb36
@ -136,6 +136,12 @@ $dbtables = array(
|
|||||||
"visittime" => "datetime NOT NULL DEFAULT 0",
|
"visittime" => "datetime NOT NULL DEFAULT 0",
|
||||||
"visitorid" => "INT",
|
"visitorid" => "INT",
|
||||||
),
|
),
|
||||||
|
|
||||||
|
"${mysqlprefix}visitedpagestatistics" => array(
|
||||||
|
"pageid" => "INT NOT NULL auto_increment PRIMARY KEY",
|
||||||
|
"address" => "varchar(1024)",
|
||||||
|
"visittime" => "datetime NOT NULL DEFAULT 0"
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
$dbtables_indexes = array(
|
$dbtables_indexes = array(
|
||||||
@ -162,6 +168,7 @@ $dbtables_can_update = array(
|
|||||||
"${mysqlprefix}chatresponses" => array("vctitle"),
|
"${mysqlprefix}chatresponses" => array("vctitle"),
|
||||||
"${mysqlprefix}chatsitevisitor" => array(),
|
"${mysqlprefix}chatsitevisitor" => array(),
|
||||||
"${mysqlprefix}visitedpage" => array(),
|
"${mysqlprefix}visitedpage" => array(),
|
||||||
|
"${mysqlprefix}visitedpagestatistics" => array(),
|
||||||
);
|
);
|
||||||
|
|
||||||
function show_install_err($text)
|
function show_install_err($text)
|
||||||
|
@ -91,6 +91,8 @@ function track_visit_page($visitorid, $page, $link)
|
|||||||
perform_query(sprintf("insert into ${mysqlprefix}visitedpage (visitorid, address, visittime) values ('%s', '%s', CURRENT_TIMESTAMP)",
|
perform_query(sprintf("insert into ${mysqlprefix}visitedpage (visitorid, address, visittime) values ('%s', '%s', CURRENT_TIMESTAMP)",
|
||||||
db_escape_string($visitorid),
|
db_escape_string($visitorid),
|
||||||
db_escape_string($page)), $link);
|
db_escape_string($page)), $link);
|
||||||
|
perform_query(sprintf("insert into ${mysqlprefix}visitedpagestatistics (address, visittime) values ('%s', CURRENT_TIMESTAMP)",
|
||||||
|
db_escape_string($page)), $link);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ $page['reportByAgent'] = select_multi_assoc("select vclocalename as name, COUNT(
|
|||||||
"where agentId = operatorid AND unix_timestamp(dtmcreated) >= $start AND unix_timestamp(dtmcreated) < $end group by operatorid", $link);
|
"where agentId = operatorid AND unix_timestamp(dtmcreated) >= $start AND unix_timestamp(dtmcreated) < $end group by operatorid", $link);
|
||||||
|
|
||||||
$page['reportByPage'] = select_multi_assoc("SELECT COUNT(p.pageid) as visittimes, p.address, COUNT(t.threadid) as chattimes " .
|
$page['reportByPage'] = select_multi_assoc("SELECT COUNT(p.pageid) as visittimes, p.address, COUNT(t.threadid) as chattimes " .
|
||||||
"FROM ${mysqlprefix}visitedpage p LEFT OUTER JOIN ${mysqlprefix}chatthread t ON (p.address = t.referer AND DATE(p.visittime) = DATE(t.dtmcreated)) " .
|
"FROM ${mysqlprefix}visitedpagestatistics p LEFT OUTER JOIN ${mysqlprefix}chatthread t ON (p.address = t.referer AND DATE(p.visittime) = DATE(t.dtmcreated)) " .
|
||||||
"WHERE unix_timestamp(p.visittime) >= $start AND unix_timestamp(p.visittime) < $end GROUP BY p.address", $link);
|
"WHERE unix_timestamp(p.visittime) >= $start AND unix_timestamp(p.visittime) < $end GROUP BY p.address", $link);
|
||||||
|
|
||||||
$page['showresults'] = count($errors) == 0;
|
$page['showresults'] = count($errors) == 0;
|
||||||
|
@ -214,7 +214,7 @@ function print_visitors()
|
|||||||
|
|
||||||
$link = connect();
|
$link = connect();
|
||||||
|
|
||||||
// Remove old visitors' tracks
|
// Remove old visitors
|
||||||
$query = "DELETE FROM ${mysqlprefix}chatsitevisitor WHERE (UNIX_TIMESTAMP(CURRENT_TIMESTAMP) - UNIX_TIMESTAMP(lasttime)) > " . $settings['tracking_lifetime'] .
|
$query = "DELETE FROM ${mysqlprefix}chatsitevisitor WHERE (UNIX_TIMESTAMP(CURRENT_TIMESTAMP) - UNIX_TIMESTAMP(lasttime)) > " . $settings['tracking_lifetime'] .
|
||||||
" AND (threadid IS NULL OR (SELECT count(*) FROM ${mysqlprefix}chatthread WHERE threadid = ${mysqlprefix}chatsitevisitor.threadid" .
|
" AND (threadid IS NULL OR (SELECT count(*) FROM ${mysqlprefix}chatthread WHERE threadid = ${mysqlprefix}chatsitevisitor.threadid" .
|
||||||
" AND istate <> $state_closed AND istate <> $state_left) = 0)";
|
" AND istate <> $state_closed AND istate <> $state_left) = 0)";
|
||||||
@ -232,6 +232,11 @@ function print_visitors()
|
|||||||
" AND istate <> $state_closed AND istate <> $state_left) = 0";
|
" AND istate <> $state_closed AND istate <> $state_left) = 0";
|
||||||
perform_query($query, $link);
|
perform_query($query, $link);
|
||||||
|
|
||||||
|
// Remove old visitors' tracks
|
||||||
|
$query = "DELETE FROM ${mysqlprefix}visitedpage WHERE (UNIX_TIMESTAMP(CURRENT_TIMESTAMP) - UNIX_TIMESTAMP(visittime)) > " . $settings['tracking_lifetime'] .
|
||||||
|
" AND visitorid NOT IN (SELECT visitorid FROM ${mysqlprefix}chatsitevisitor)";
|
||||||
|
perform_query($query, $link);
|
||||||
|
|
||||||
$output = array();
|
$output = array();
|
||||||
|
|
||||||
$query = "SELECT visitorid, userid, username, unix_timestamp(firsttime), unix_timestamp(lasttime), " .
|
$query = "SELECT visitorid, userid, username, unix_timestamp(firsttime), unix_timestamp(lasttime), " .
|
||||||
|
Loading…
Reference in New Issue
Block a user