issue 2771 counter patch apply by bnufactory

git-svn-id: http://xe-core.googlecode.com/svn/branches/maserati@12683 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
ovclas 2013-02-04 08:33:40 +00:00
parent 669c9a5948
commit 854e45afaa
6 changed files with 46 additions and 22 deletions

View file

@ -89,17 +89,13 @@ class counterController extends counter
{
if($site_srl)
{
$args->regdate = '0';
$args->regdate = '0' . date('Ymd');
$args->site_srl = $site_srl;
$output = executeQuery('counter.updateSiteCounterUnique', $args);
$args->regdate = date('Ymd');
$output = executeQuery('counter.updateSiteCounterUnique', $args);
}
else
{
$args->regdate = '0';
$output = executeQuery('counter.updateCounterUnique', $args);
$args->regdate = date('Ymd');
$args->regdate = '0' . date('Ymd');
$output = executeQuery('counter.updateCounterUnique', $args);
}
}
@ -112,19 +108,16 @@ class counterController extends counter
*/
function insertPageView($site_srl=0)
{
$args = new stdClass;
$args->regdate = '0,' . date('Ymd');
if($site_srl)
{
$args->regdate = '0';
$args->site_srl = $site_srl;
executeQuery('counter.updateSiteCounterPageview', $args);
$args->regdate = date('Ymd');
executeQuery('counter.updateSiteCounterPageview', $args);
}
else
{
$args->regdate = '0';
executeQuery('counter.updateCounterPageview', $args);
$args->regdate = date('Ymd');
executeQuery('counter.updateCounterPageview', $args);
}
}
@ -137,6 +130,7 @@ class counterController extends counter
*/
function insertTotalStatus($site_srl=0)
{
$args = new stdClass;
$args->regdate = 0;
if($site_srl)
{
@ -158,6 +152,7 @@ class counterController extends counter
*/
function insertTodayStatus($regdate = 0, $site_srl=0)
{
$args = new stdClass;
if($regdate) $args->regdate = $regdate;
else $args->regdate = date("Ymd");
if($site_srl)

View file

@ -23,11 +23,25 @@ class counterModel extends counter
*/
function isLogged($site_srl=0)
{
$args->regdate = date("Ymd");
$args = new stdClass;
$args->regdate = date('Ymd');
$args->ipaddress = $_SERVER['REMOTE_ADDR'];
$args->site_srl = $site_srl;
$oCacheHandler = &CacheHandler::getInstance('object');
if($oCacheHandler->isSupport())
{
$object_key = 'object:' . $site_srl . '_' . str_replace('.', '-', $args->ipaddress);
$cache_key = $oCacheHandler->getGroupKey('counterIpLogged_' . $args->regdate, $object_key);
if($oCacheHandler->isValid($cache_key)) return $oCacheHandler->get($cache_key);
}
$output = executeQuery('counter.getCounterLog', $args);
return $output->data->count?true:false;
$result = $output->data->count ? TRUE : FALSE;
if($result && $oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $result);
return $result;
}
/**
@ -38,17 +52,32 @@ class counterModel extends counter
*/
function isInsertedTodayStatus($site_srl=0)
{
$args->regdate = date("Ymd");
$args = new stdClass;
$args->regdate = date('Ymd');
$oCacheHandler = &CacheHandler::getInstance('object', NULL, TRUE);
if($oCacheHandler->isSupport())
{
$cache_key = 'object:insertedTodayStatus:' . $site_srl . '_' . $args->regdate;
if($oCacheHandler->isValid($cache_key)) return $oCacheHandler->get($cache_key);
}
if($site_srl)
{
$args->site_srl = $site_srl;
$output = executeQuery('counter.getSiteTodayStatus', $args);
}
else
else $output = executeQuery('counter.getTodayStatus', $args);
$result = $output->data->count ? TRUE : FALSE;
if($result && $oCacheHandler->isSupport())
{
$output = executeQuery('counter.getTodayStatus', $args);
$oCacheHandler->put($cache_key, $result);
$_old_date = date('Ymd', strtotime('-1 day'));
$oCacheHandler->delete('object:insertedTodayStatus:' . $site_srl . '_' . $_old_date);
}
return $output->data->count?true:false;
return $result;
}
/**

View file

@ -6,6 +6,6 @@
<column name="pageview" default="plus(1)" />
</columns>
<conditions>
<condition operation="equal" column="regdate" var="regdate" notnull="notnull" />
<condition operation="in" column="regdate" var="regdate" notnull="notnull" />
</conditions>
</query>

View file

@ -7,6 +7,6 @@
<column name="pageview" default="plus(1)" />
</columns>
<conditions>
<condition operation="equal" column="regdate" var="regdate" notnull="notnull" />
<condition operation="in" column="regdate" var="regdate" notnull="notnull" />
</conditions>
</query>

View file

@ -7,6 +7,6 @@
</columns>
<conditions>
<condition operation="equal" column="site_srl" var="site_srl" default="0" />
<condition operation="equal" column="regdate" var="regdate" notnull="notnull" pipe="and" />
<condition operation="in" column="regdate" var="regdate" notnull="notnull" pipe="and" />
</conditions>
</query>

View file

@ -8,6 +8,6 @@
</columns>
<conditions>
<condition operation="equal" column="site_srl" var="site_srl" notnull="notnull" />
<condition operation="equal" column="regdate" var="regdate" notnull="notnull" pipe="and" />
<condition operation="in" column="regdate" var="regdate" notnull="notnull" pipe="and" />
</conditions>
</query>