mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-04 01:01:41 +09:00
Clean up counter module
- 카운터 모듈을 정리하여 불필요한 쿼리 및 트랜잭션 제거 - 매일 첫 방문시 쿼리 오류 발생하는 문제 해결 - 더이상 사용하지 않는 $site_srl 기준의 테이블은 삭제
This commit is contained in:
parent
350d0cd20c
commit
8d2b105847
21 changed files with 83 additions and 379 deletions
|
|
@ -10,7 +10,7 @@ if(!defined('__XE__'))
|
||||||
* @brief Counter add-on
|
* @brief Counter add-on
|
||||||
*/
|
*/
|
||||||
// Execute if called_position is before_display_content
|
// Execute if called_position is before_display_content
|
||||||
if($called_position == 'before_module_init' && Context::get('module') != 'admin' && Context::getResponseMethod() == 'HTML' && Context::isInstalled() && !isCrawler())
|
if($called_position == 'before_display_content' && Context::get('module') != 'admin' && Context::getResponseMethod() == 'HTML' && Context::isInstalled() && !isCrawler())
|
||||||
{
|
{
|
||||||
$oCounterController = getController('counter');
|
$oCounterController = getController('counter');
|
||||||
$oCounterController->counterExecute();
|
$oCounterController->counterExecute();
|
||||||
|
|
|
||||||
|
|
@ -41,22 +41,19 @@ class counterAdminView extends counter
|
||||||
$oCounterModel = getModel('counter');
|
$oCounterModel = getModel('counter');
|
||||||
|
|
||||||
// get a total count and daily count
|
// get a total count and daily count
|
||||||
$site_module_info = Context::get('site_module_info');
|
$status = $oCounterModel->getStatus(array(0, $selected_date));
|
||||||
$status = $oCounterModel->getStatus(array(0, $selected_date), $site_module_info->site_srl);
|
|
||||||
|
|
||||||
Context::set('total_counter', $status[0]);
|
Context::set('total_counter', $status[0]);
|
||||||
Context::set('selected_day_counter', $status[$selected_date]);
|
Context::set('selected_day_counter', $status[$selected_date]);
|
||||||
|
|
||||||
// get data by time, day, month, and year
|
// get data by time, day, month, and year
|
||||||
$type = Context::get('type');
|
$type = Context::get('type');
|
||||||
|
|
||||||
if(!$type)
|
if(!$type)
|
||||||
{
|
{
|
||||||
$type = 'day';
|
$type = 'day';
|
||||||
Context::set('type', $type);
|
Context::set('type', $type);
|
||||||
}
|
}
|
||||||
|
|
||||||
$detail_status = $oCounterModel->getHourlyStatus($type, $selected_date, $site_module_info->site_srl);
|
$detail_status = $oCounterModel->getHourlyStatus($type, $selected_date);
|
||||||
Context::set('detail_status', $detail_status);
|
Context::set('detail_status', $detail_status);
|
||||||
|
|
||||||
// display
|
// display
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,13 @@ class counter extends ModuleObject
|
||||||
*/
|
*/
|
||||||
function checkUpdate()
|
function checkUpdate()
|
||||||
{
|
{
|
||||||
return FALSE;
|
$oDB = DB::getInstance();
|
||||||
|
if ($oDB->isTableExists('counter_site_status'))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -35,7 +41,11 @@ class counter extends ModuleObject
|
||||||
*/
|
*/
|
||||||
function moduleUpdate()
|
function moduleUpdate()
|
||||||
{
|
{
|
||||||
|
$oDB = DB::getInstance();
|
||||||
|
if ($oDB->isTableExists('counter_site_status'))
|
||||||
|
{
|
||||||
|
$oDB->dropTable('counter_site_status');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -37,178 +37,98 @@ class counterController extends counter
|
||||||
*/
|
*/
|
||||||
function counterExecute()
|
function counterExecute()
|
||||||
{
|
{
|
||||||
$oDB = DB::getInstance();
|
if(CounterModel::isLogged())
|
||||||
$oDB->begin();
|
|
||||||
|
|
||||||
$site_module_info = Context::get('site_module_info');
|
|
||||||
$site_srl = (int) $site_module_info->site_srl;
|
|
||||||
|
|
||||||
// Check the logs
|
|
||||||
$oCounterModel = getModel('counter');
|
|
||||||
|
|
||||||
if($oCounterModel->isInsertedTodayStatus($site_srl))
|
|
||||||
{
|
{
|
||||||
if($oCounterModel->isLogged($site_srl))
|
$this->insertPageView();
|
||||||
{
|
|
||||||
// Register pageview
|
|
||||||
$this->insertPageView($site_srl);
|
|
||||||
}
|
|
||||||
else // If unregistered IP
|
|
||||||
{
|
|
||||||
// Leave logs
|
|
||||||
$this->insertLog($site_srl);
|
|
||||||
// Register unique and pageview
|
|
||||||
$this->insertUniqueVisitor($site_srl);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else // Register today's row if not exist
|
else
|
||||||
{
|
{
|
||||||
$this->insertTodayStatus(0, $site_srl);
|
$this->insertUniqueVisitor();
|
||||||
// check user if the previous row exists
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$oDB->commit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Leave logs
|
* Leave logs
|
||||||
*
|
*
|
||||||
* @param integer $site_srl
|
* @return void
|
||||||
* @return Object result of count query
|
|
||||||
*/
|
*/
|
||||||
function insertLog($site_srl = 0)
|
public function insertLog()
|
||||||
{
|
{
|
||||||
$args = new stdClass();
|
$args = new stdClass();
|
||||||
$args->regdate = date("YmdHis");
|
$args->regdate = date('YmdHis');
|
||||||
$args->user_agent = substr($_SERVER['HTTP_USER_AGENT'], 0, 250);
|
$args->user_agent = substr($_SERVER['HTTP_USER_AGENT'], 0, 250);
|
||||||
$args->site_srl = $site_srl;
|
$args->site_srl = 0;
|
||||||
|
executeQuery('counter.insertCounterLog', $args);
|
||||||
return executeQuery('counter.insertCounterLog', $args);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register the unique visitor
|
* Register the unique visitor
|
||||||
*
|
*
|
||||||
* @param integer $site_srl
|
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function insertUniqueVisitor($site_srl = 0)
|
public function insertUniqueVisitor()
|
||||||
{
|
{
|
||||||
$args = new stdClass();
|
$oDB = DB::getInstance();
|
||||||
$args->regdate = '0,' . date('Ymd');
|
$oDB->begin();
|
||||||
|
|
||||||
if($site_srl)
|
$args = new stdClass();
|
||||||
|
$args->regdate = [0, $date = date('Ymd')];
|
||||||
|
executeQuery('counter.updateCounterUnique', $args);
|
||||||
|
|
||||||
|
$affected_rows = $oDB->getAffectedRows();
|
||||||
|
if ($affected_rows == 1)
|
||||||
{
|
{
|
||||||
$args->site_srl = $site_srl;
|
$args = new stdClass;
|
||||||
$output = executeQuery('counter.updateSiteCounterUnique', $args);
|
$args->regdate = $date;
|
||||||
|
executeQuery('counter.insertTodayStatus', $args);
|
||||||
}
|
}
|
||||||
else
|
if ($affected_rows == 0)
|
||||||
{
|
{
|
||||||
$output = executeQuery('counter.updateCounterUnique', $args);
|
$args = new stdClass;
|
||||||
|
$args->regdate = 0;
|
||||||
|
executeQuery('counter.insertTodayStatus', $args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->insertLog();
|
||||||
|
|
||||||
|
$oDB->commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register pageview
|
* Register pageview
|
||||||
*
|
*
|
||||||
* @param integer $site_srl
|
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function insertPageView($site_srl = 0)
|
public function insertPageView()
|
||||||
{
|
{
|
||||||
$args = new stdClass;
|
$args = new stdClass;
|
||||||
$args->regdate = '0,' . date('Ymd');
|
$args->regdate = [0, date('Ymd')];
|
||||||
|
executeQuery('counter.updateCounterPageview', $args);
|
||||||
if($site_srl)
|
|
||||||
{
|
|
||||||
$args->site_srl = $site_srl;
|
|
||||||
executeQuery('counter.updateSiteCounterPageview', $args);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
executeQuery('counter.updateCounterPageview', $args);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add the total counter status
|
* @deprecated
|
||||||
*
|
|
||||||
* @param integer $site_srl
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
function insertTotalStatus($site_srl = 0)
|
public function insertTodayStatus()
|
||||||
{
|
{
|
||||||
$args = new stdClass();
|
$this->insertUniqueVisitor();
|
||||||
$args->regdate = 0;
|
|
||||||
|
|
||||||
if($site_srl)
|
|
||||||
{
|
|
||||||
$args->site_srl = $site_srl;
|
|
||||||
executeQuery('counter.insertSiteTodayStatus', $args);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
executeQuery('counter.insertTodayStatus', $args);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add today's counter status
|
* @deprecated
|
||||||
*
|
|
||||||
* @param integer $regdate date(YYYYMMDD) type
|
|
||||||
* @param integer $site_srl
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
function insertTodayStatus($regdate = 0, $site_srl = 0)
|
public function insertTotalStatus()
|
||||||
{
|
{
|
||||||
$args = new stdClass();
|
|
||||||
if($regdate)
|
|
||||||
{
|
|
||||||
$args->regdate = $regdate;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$args->regdate = date("Ymd");
|
|
||||||
}
|
|
||||||
|
|
||||||
if($site_srl)
|
|
||||||
{
|
|
||||||
$args->site_srl = $site_srl;
|
|
||||||
$query_id = 'counter.insertSiteTodayStatus';
|
|
||||||
|
|
||||||
$u_args = new stdClass();
|
|
||||||
$u_args->site_srl = $site_srl; // /< when inserting a daily row, attempt to inser total rows(where regdate=0) together
|
|
||||||
executeQuery($query_id, $u_args);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$query_id = 'counter.insertTodayStatus';
|
|
||||||
executeQuery($query_id); // /< when inserting a daily row, attempt to inser total rows(where regdate=0) together
|
|
||||||
}
|
|
||||||
|
|
||||||
$output = executeQuery($query_id, $args);
|
|
||||||
|
|
||||||
// Leave logs
|
|
||||||
$this->insertLog($site_srl);
|
|
||||||
|
|
||||||
// Register unique and pageview
|
|
||||||
$this->insertUniqueVisitor($site_srl);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete counter logs of the specific virtual site
|
* @deprecated
|
||||||
*
|
|
||||||
* @param integer $site_srl
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
function deleteSiteCounterLogs($site_srl)
|
public function deleteSiteCounterLogs()
|
||||||
{
|
{
|
||||||
$args = new stdClass();
|
|
||||||
$args->site_srl = $site_srl;
|
|
||||||
executeQuery('counter.deleteSiteCounter', $args);
|
|
||||||
executeQuery('counter.deleteSiteCounterLog', $args);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/* End of file counter.controller.php */
|
/* End of file counter.controller.php */
|
||||||
/* Location: ./modules/counter/counter.controller.php */
|
/* Location: ./modules/counter/counter.controller.php */
|
||||||
|
|
|
||||||
|
|
@ -20,13 +20,12 @@ class counterModel extends counter
|
||||||
/**
|
/**
|
||||||
* Verify logs
|
* Verify logs
|
||||||
*
|
*
|
||||||
* @param integer $site_srl Site_srl
|
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
function isLogged($site_srl = 0)
|
public static function isLogged()
|
||||||
{
|
{
|
||||||
$date = date('Ymd');
|
$date = date('Ymd');
|
||||||
if (isset($_SESSION['counter_logged'][$date]) && $_SESSION['counter_logged'][$date])
|
if (isset($_SESSION['counter_logged'][$date]))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -34,7 +33,6 @@ class counterModel extends counter
|
||||||
$args = new stdClass();
|
$args = new stdClass();
|
||||||
$args->regdate = $date;
|
$args->regdate = $date;
|
||||||
$args->ipaddress = \RX_CLIENT_IP;
|
$args->ipaddress = \RX_CLIENT_IP;
|
||||||
$args->site_srl = $site_srl;
|
|
||||||
$output = executeQuery('counter.getCounterLog', $args);
|
$output = executeQuery('counter.getCounterLog', $args);
|
||||||
$iplogged = $output->data->count ? true : false;
|
$iplogged = $output->data->count ? true : false;
|
||||||
if ($iplogged)
|
if ($iplogged)
|
||||||
|
|
@ -48,63 +46,25 @@ class counterModel extends counter
|
||||||
/**
|
/**
|
||||||
* Check if a row of today's counter status exists
|
* Check if a row of today's counter status exists
|
||||||
*
|
*
|
||||||
* @param integer $site_srl Site_srl
|
* @deprecated
|
||||||
* @return bool
|
|
||||||
*/
|
*/
|
||||||
function isInsertedTodayStatus($site_srl = 0)
|
public static function isInsertedTodayStatus()
|
||||||
{
|
{
|
||||||
$args = new stdClass;
|
|
||||||
$args->regdate = date('Ymd');
|
|
||||||
|
|
||||||
$cache_key = 'counter:insertedTodayStatus:' . $site_srl . '_' . $args->regdate;
|
|
||||||
$insertedTodayStatus = Rhymix\Framework\Cache::get($cache_key);
|
|
||||||
|
|
||||||
if(!$insertedTodayStatus)
|
|
||||||
{
|
|
||||||
if($site_srl)
|
|
||||||
{
|
|
||||||
$args->site_srl = $site_srl;
|
|
||||||
$output = executeQuery('counter.getSiteTodayStatus', $args);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$output = executeQuery('counter.getTodayStatus', $args);
|
|
||||||
}
|
|
||||||
|
|
||||||
$insertedTodayStatus = !!$output->data->count;
|
|
||||||
|
|
||||||
if($insertedTodayStatus)
|
|
||||||
{
|
|
||||||
Rhymix\Framework\Cache::set($cache_key, true, 0, true);
|
|
||||||
$_old_date = date('Ymd', strtotime('-1 day'));
|
|
||||||
Rhymix\Framework\Cache::delete('counter:insertedTodayStatus:' . $site_srl . '_' . $_old_date);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $insertedTodayStatus;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get access statistics for a given date
|
* Get access statistics for a given date
|
||||||
*
|
*
|
||||||
* @param mixed $selected_date Date(YYYYMMDD) list
|
* @param mixed $selected_date Date(YYYYMMDD) list
|
||||||
* @param integer $site_srl Site_srl
|
|
||||||
* @return Object
|
* @return Object
|
||||||
*/
|
*/
|
||||||
function getStatus($selected_date, $site_srl = 0)
|
public static function getStatus($selected_date)
|
||||||
{
|
{
|
||||||
// If more than one date logs are selected
|
// If more than one date logs are selected
|
||||||
$args = new stdClass();
|
$args = new stdClass();
|
||||||
$args->regdate = is_array($selected_date) ? join(',', $selected_date) : $selected_date;
|
$args->regdate = is_array($selected_date) ? join(',', $selected_date) : $selected_date;
|
||||||
if($site_srl)
|
$output = executeQueryArray('counter.getCounterStatusDays', $args);
|
||||||
{
|
|
||||||
$args->site_srl = $site_srl;
|
|
||||||
$output = executeQuery('counter.getSiteCounterStatusDays', $args);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$output = executeQuery('counter.getCounterStatusDays', $args);
|
|
||||||
}
|
|
||||||
$status = $output->data;
|
$status = $output->data;
|
||||||
|
|
||||||
if(!is_array($selected_date))
|
if(!is_array($selected_date))
|
||||||
|
|
@ -112,7 +72,6 @@ class counterModel extends counter
|
||||||
return $status;
|
return $status;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!is_array($status)) $status = array($status);
|
|
||||||
$output = array();
|
$output = array();
|
||||||
foreach($status as $val)
|
foreach($status as $val)
|
||||||
{
|
{
|
||||||
|
|
@ -127,10 +86,10 @@ class counterModel extends counter
|
||||||
*
|
*
|
||||||
* @param string $type Choice time interval (year, week, month, hour or DEFAULT)
|
* @param string $type Choice time interval (year, week, month, hour or DEFAULT)
|
||||||
* @param integer $selected_date Date(YYYYMMDD)
|
* @param integer $selected_date Date(YYYYMMDD)
|
||||||
* @param integer $site_srl Site_srl
|
* @param integer $site_srl unused
|
||||||
* @return Object
|
* @return Object
|
||||||
*/
|
*/
|
||||||
function getHourlyStatus($type = 'hour', $selected_date, $site_srl = 0, $isPageView = false)
|
public static function getHourlyStatus($type = 'hour', $selected_date, $site_srl = 0, $isPageView = false)
|
||||||
{
|
{
|
||||||
$max = 0;
|
$max = 0;
|
||||||
$sum = 0;
|
$sum = 0;
|
||||||
|
|
@ -140,17 +99,7 @@ class counterModel extends counter
|
||||||
{
|
{
|
||||||
case 'year' :
|
case 'year' :
|
||||||
// Get a date to start counting
|
// Get a date to start counting
|
||||||
if($site_srl)
|
$output = executeQuery('counter.getStartLogDate', new stdClass);
|
||||||
{
|
|
||||||
$args = new stdClass();
|
|
||||||
$args->site_srl = $site_srl;
|
|
||||||
$output = executeQuery('counter.getSiteStartLogDate', $args);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$output = executeQuery('counter.getStartLogDate');
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!($start_year = substr($output->data->regdate, 0, 4)))
|
if(!($start_year = substr($output->data->regdate, 0, 4)))
|
||||||
{
|
{
|
||||||
$start_year = date("Y");
|
$start_year = date("Y");
|
||||||
|
|
@ -161,17 +110,7 @@ class counterModel extends counter
|
||||||
$args = new stdClass();
|
$args = new stdClass();
|
||||||
$args->start_date = sprintf('%04d0000', $i);
|
$args->start_date = sprintf('%04d0000', $i);
|
||||||
$args->end_date = sprintf('%04d1231', $i);
|
$args->end_date = sprintf('%04d1231', $i);
|
||||||
|
$output = executeQuery('counter.getCounterStatus', $args);
|
||||||
if($site_srl)
|
|
||||||
{
|
|
||||||
$args->site_srl = $site_srl;
|
|
||||||
$output = executeQuery('counter.getSiteCounterStatus', $args);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$output = executeQuery('counter.getCounterStatus', $args);
|
|
||||||
}
|
|
||||||
|
|
||||||
$count = (int)($isPageView ? $output->data->pageview : $output->data->unique_visitor);
|
$count = (int)($isPageView ? $output->data->pageview : $output->data->unique_visitor);
|
||||||
$status->list[$i] = $count;
|
$status->list[$i] = $count;
|
||||||
|
|
||||||
|
|
@ -207,17 +146,7 @@ class counterModel extends counter
|
||||||
$args = new stdClass();
|
$args = new stdClass();
|
||||||
$args->start_date = $day;
|
$args->start_date = $day;
|
||||||
$args->end_date = $day;
|
$args->end_date = $day;
|
||||||
|
$output = executeQuery('counter.getCounterStatus', $args);
|
||||||
if($site_srl)
|
|
||||||
{
|
|
||||||
$args->site_srl = $site_srl;
|
|
||||||
$output = executeQuery('counter.getSiteCounterStatus', $args);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$output = executeQuery('counter.getCounterStatus', $args);
|
|
||||||
}
|
|
||||||
|
|
||||||
$count = (int)($isPageView ? $output->data->pageview : $output->data->unique_visitor);
|
$count = (int)($isPageView ? $output->data->pageview : $output->data->unique_visitor);
|
||||||
$status->list[$day] = $count;
|
$status->list[$day] = $count;
|
||||||
|
|
||||||
|
|
@ -234,17 +163,7 @@ class counterModel extends counter
|
||||||
$args = new stdClass();
|
$args = new stdClass();
|
||||||
$args->start_date = sprintf('%04d%02d00', $year, $i);
|
$args->start_date = sprintf('%04d%02d00', $year, $i);
|
||||||
$args->end_date = sprintf('%04d%02d31', $year, $i);
|
$args->end_date = sprintf('%04d%02d31', $year, $i);
|
||||||
|
$output = executeQuery('counter.getCounterStatus', $args);
|
||||||
if($site_srl)
|
|
||||||
{
|
|
||||||
$args->site_srl = $site_srl;
|
|
||||||
$output = executeQuery('counter.getSiteCounterStatus', $args);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$output = executeQuery('counter.getCounterStatus', $args);
|
|
||||||
}
|
|
||||||
|
|
||||||
$count = (int)($isPageView ? $output->data->pageview : $output->data->unique_visitor);
|
$count = (int)($isPageView ? $output->data->pageview : $output->data->unique_visitor);
|
||||||
$status->list[$i] = $count;
|
$status->list[$i] = $count;
|
||||||
|
|
||||||
|
|
@ -260,18 +179,7 @@ class counterModel extends counter
|
||||||
$args = new stdClass();
|
$args = new stdClass();
|
||||||
$args->start_date = sprintf('%08d%02d0000', $selected_date, $i);
|
$args->start_date = sprintf('%08d%02d0000', $selected_date, $i);
|
||||||
$args->end_date = sprintf('%08d%02d5959', $selected_date, $i);
|
$args->end_date = sprintf('%08d%02d5959', $selected_date, $i);
|
||||||
|
$output = executeQuery('counter.getCounterLogStatus', $args);
|
||||||
if($site_srl)
|
|
||||||
{
|
|
||||||
$args->site_srl = $site_srl;
|
|
||||||
$output = executeQuery('counter.getSiteCounterLogStatus', $args);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$args->site_srl = 0;
|
|
||||||
$output = executeQuery('counter.getCounterLogStatus', $args);
|
|
||||||
}
|
|
||||||
|
|
||||||
$count = (int) $output->data->count;
|
$count = (int) $output->data->count;
|
||||||
$status->list[$i] = $count;
|
$status->list[$i] = $count;
|
||||||
|
|
||||||
|
|
@ -291,17 +199,7 @@ class counterModel extends counter
|
||||||
$args = new stdClass();
|
$args = new stdClass();
|
||||||
$args->start_date = sprintf('%04d%02d%02d', $year, $month, $i);
|
$args->start_date = sprintf('%04d%02d%02d', $year, $month, $i);
|
||||||
$args->end_date = sprintf('%04d%02d%02d', $year, $month, $i);
|
$args->end_date = sprintf('%04d%02d%02d', $year, $month, $i);
|
||||||
|
$output = executeQuery('counter.getCounterStatus', $args);
|
||||||
if($site_srl)
|
|
||||||
{
|
|
||||||
$args->site_srl = $site_srl;
|
|
||||||
$output = executeQuery('counter.getSiteCounterStatus', $args);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$output = executeQuery('counter.getCounterStatus', $args);
|
|
||||||
}
|
|
||||||
|
|
||||||
$count = (int)($isPageView ? $output->data->pageview : $output->data->unique_visitor);
|
$count = (int)($isPageView ? $output->data->pageview : $output->data->unique_visitor);
|
||||||
$status->list[$i] = $count;
|
$status->list[$i] = $count;
|
||||||
|
|
||||||
|
|
@ -322,7 +220,7 @@ class counterModel extends counter
|
||||||
{
|
{
|
||||||
//for last week
|
//for last week
|
||||||
$date1 = date('Ymd', strtotime('-1 week'));
|
$date1 = date('Ymd', strtotime('-1 week'));
|
||||||
$output1 = $this->getHourlyStatus('week', $date1);
|
$output1 = self::getHourlyStatus('week', $date1);
|
||||||
|
|
||||||
$tmp = array();
|
$tmp = array();
|
||||||
foreach($output1->list as $key => $value)
|
foreach($output1->list as $key => $value)
|
||||||
|
|
@ -333,7 +231,7 @@ class counterModel extends counter
|
||||||
|
|
||||||
//for this week
|
//for this week
|
||||||
$date2 = date('Ymd');
|
$date2 = date('Ymd');
|
||||||
$output2 = $this->getHourlyStatus('week', $date2);
|
$output2 = self::getHourlyStatus('week', $date2);
|
||||||
|
|
||||||
$tmp = array();
|
$tmp = array();
|
||||||
foreach($output2->list as $key => $value)
|
foreach($output2->list as $key => $value)
|
||||||
|
|
@ -350,7 +248,7 @@ class counterModel extends counter
|
||||||
{
|
{
|
||||||
//for last week
|
//for last week
|
||||||
$date1 = date('Ymd', strtotime('-1 week'));
|
$date1 = date('Ymd', strtotime('-1 week'));
|
||||||
$output1 = $this->getHourlyStatus('week', $date1, 0, TRUE);
|
$output1 = self::getHourlyStatus('week', $date1, 0, TRUE);
|
||||||
|
|
||||||
$tmp = array();
|
$tmp = array();
|
||||||
foreach($output1->list as $key => $value)
|
foreach($output1->list as $key => $value)
|
||||||
|
|
@ -361,7 +259,7 @@ class counterModel extends counter
|
||||||
|
|
||||||
//for this week
|
//for this week
|
||||||
$date2 = date('Ymd');
|
$date2 = date('Ymd');
|
||||||
$output2 = $this->getHourlyStatus('week', $date2, 0, TRUE);
|
$output2 = self::getHourlyStatus('week', $date2, 0, TRUE);
|
||||||
|
|
||||||
$tmp = array();
|
$tmp = array();
|
||||||
foreach($output2->list as $key => $value)
|
foreach($output2->list as $key => $value)
|
||||||
|
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
<query id="deleteSiteCounter" action="delete">
|
|
||||||
<tables>
|
|
||||||
<table name="counter_site_status" />
|
|
||||||
</tables>
|
|
||||||
<conditions>
|
|
||||||
<condition operation="equal" column="site_srl" var="site_srl" filter="number" notnull="notnull" pipe="and" />
|
|
||||||
</conditions>
|
|
||||||
</query>
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
<query id="deleteSiteCounterLog" action="delete">
|
|
||||||
<tables>
|
|
||||||
<table name="counter_log" />
|
|
||||||
</tables>
|
|
||||||
<conditions>
|
|
||||||
<condition operation="equal" column="site_srl" var="site_srl" filter="number" notnull="notnull" pipe="and" />
|
|
||||||
</conditions>
|
|
||||||
</query>
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
<column name="count(*)" alias="count" />
|
<column name="count(*)" alias="count" />
|
||||||
</columns>
|
</columns>
|
||||||
<conditions>
|
<conditions>
|
||||||
<condition operation="equal" column="site_srl" var="site_srl" default="0" pipe="and" />
|
<condition operation="equal" column="site_srl" var="site_srl" />
|
||||||
<condition operation="equal" column="ipaddress" var="ipaddress" pipe="and" />
|
<condition operation="equal" column="ipaddress" var="ipaddress" pipe="and" />
|
||||||
<condition operation="like_prefix" column="regdate" var="regdate" notnull="notnull" pipe="and" />
|
<condition operation="like_prefix" column="regdate" var="regdate" notnull="notnull" pipe="and" />
|
||||||
</conditions>
|
</conditions>
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
<column name="count(*)" alias="count" />
|
<column name="count(*)" alias="count" />
|
||||||
</columns>
|
</columns>
|
||||||
<conditions>
|
<conditions>
|
||||||
<condition operation="equal" column="site_srl" var="site_srl" notnull="notnull" pipe="and" />
|
<condition operation="equal" column="site_srl" var="site_srl" />
|
||||||
<condition operation="more" column="regdate" var="start_date" notnull="notnull" pipe="and" />
|
<condition operation="more" column="regdate" var="start_date" notnull="notnull" pipe="and" />
|
||||||
<condition operation="less" column="regdate" var="end_date" notnull="notnull" pipe="and" />
|
<condition operation="less" column="regdate" var="end_date" notnull="notnull" pipe="and" />
|
||||||
</conditions>
|
</conditions>
|
||||||
|
|
|
||||||
|
|
@ -1,14 +0,0 @@
|
||||||
<query id="getSiteCounterStatus" action="select">
|
|
||||||
<tables>
|
|
||||||
<table name="counter_site_status" />
|
|
||||||
</tables>
|
|
||||||
<columns>
|
|
||||||
<column name="sum(unique_visitor)" alias="unique_visitor" />
|
|
||||||
<column name="sum(pageview)" alias="pageview" />
|
|
||||||
</columns>
|
|
||||||
<conditions>
|
|
||||||
<condition operation="equal" column="site_srl" var="site_srl" default="0" />
|
|
||||||
<condition operation="more" column="regdate" var="start_date" notnull="notnull" pipe="and" />
|
|
||||||
<condition operation="less" column="regdate" var="end_date" notnull="notnull" pipe="and" />
|
|
||||||
</conditions>
|
|
||||||
</query>
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
<query id="getSiteCounterStatus" action="select">
|
|
||||||
<tables>
|
|
||||||
<table name="counter_site_status" />
|
|
||||||
</tables>
|
|
||||||
<columns>
|
|
||||||
<column name="*" />
|
|
||||||
</columns>
|
|
||||||
<conditions>
|
|
||||||
<condition operation="equal" column="site_srl" var="site_srl" default="0" />
|
|
||||||
<condition operation="in" column="regdate" var="regdate" notnull="notnull" pipe="and" />
|
|
||||||
</conditions>
|
|
||||||
</query>
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
<query id="getSiteStartLogDate" action="select">
|
<query id="getSiteLogDate" action="select">
|
||||||
<tables>
|
<tables>
|
||||||
<table name="counter_status" />
|
<table name="counter_status" />
|
||||||
</tables>
|
</tables>
|
||||||
|
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
<query id="getSiteStartLogDate" action="select">
|
|
||||||
<tables>
|
|
||||||
<table name="counter_site_status" />
|
|
||||||
</tables>
|
|
||||||
<columns>
|
|
||||||
<column name="min(regdate)" alias="regdate" />
|
|
||||||
</columns>
|
|
||||||
<conditions>
|
|
||||||
<condition operation="equal" column="site_srl" var="site_srl" notnull="notnull" />
|
|
||||||
<condition operation="excess" column="regdate" default="1" notnull="notnull" pipe="and" />
|
|
||||||
</conditions>
|
|
||||||
</query>
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
<query id="getSiteTodayStatus" action="select">
|
|
||||||
<tables>
|
|
||||||
<table name="counter_site_status" />
|
|
||||||
</tables>
|
|
||||||
<columns>
|
|
||||||
<column name="count(*)" alias="count" />
|
|
||||||
</columns>
|
|
||||||
<conditions>
|
|
||||||
<condition operation="equal" column="site_srl" var="site_srl" default="0" />
|
|
||||||
<condition operation="equal" column="regdate" var="regdate" notnull="notnull" pipe="and" />
|
|
||||||
</conditions>
|
|
||||||
</query>
|
|
||||||
|
|
@ -3,8 +3,8 @@
|
||||||
<table name="counter_log" />
|
<table name="counter_log" />
|
||||||
</tables>
|
</tables>
|
||||||
<columns>
|
<columns>
|
||||||
<column name="site_srl" var="site_srl" notnull="notnull" default="0" />
|
<column name="site_srl" var="site_srl" default="0" />
|
||||||
<column name="regdate" var="regdate" default="curdate()" notnull="notnull" />
|
<column name="regdate" var="regdate" notnull="notnull" default="curdate()" />
|
||||||
<column name="ipaddress" var="ipaddress" notnull="notnull" default="ipaddress()" />
|
<column name="ipaddress" var="ipaddress" notnull="notnull" default="ipaddress()" />
|
||||||
<column name="user_agent" var="user_agent" />
|
<column name="user_agent" var="user_agent" />
|
||||||
</columns>
|
</columns>
|
||||||
|
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
<query id="insertSiteTodayStatus" action="insert">
|
|
||||||
<tables>
|
|
||||||
<table name="counter_site_status" />
|
|
||||||
</tables>
|
|
||||||
<columns>
|
|
||||||
<column name="site_srl" var="site_srl" notnull="notnull" default="0" />
|
|
||||||
<column name="regdate" var="regdate" default="0" notnull="notnull" />
|
|
||||||
<column name="unique_visitor" default="0" />
|
|
||||||
<column name="pageview" default="0" />
|
|
||||||
</columns>
|
|
||||||
</query>
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
</tables>
|
</tables>
|
||||||
<columns>
|
<columns>
|
||||||
<column name="regdate" var="regdate" default="0" notnull="notnull" />
|
<column name="regdate" var="regdate" default="0" notnull="notnull" />
|
||||||
<column name="unique_visitor" default="0" />
|
<column name="unique_visitor" var="unique_visitor" default="1" />
|
||||||
<column name="pageview" default="0" />
|
<column name="pageview" var="pageview" default="1" />
|
||||||
</columns>
|
</columns>
|
||||||
</query>
|
</query>
|
||||||
|
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
<query id="updateSiteCounterPageview" action="update">
|
|
||||||
<tables>
|
|
||||||
<table name="counter_site_status" />
|
|
||||||
</tables>
|
|
||||||
<columns>
|
|
||||||
<column name="pageview" default="plus(1)" />
|
|
||||||
</columns>
|
|
||||||
<conditions>
|
|
||||||
<condition operation="equal" column="site_srl" var="site_srl" default="0" />
|
|
||||||
<condition operation="in" column="regdate" var="regdate" notnull="notnull" pipe="and" />
|
|
||||||
</conditions>
|
|
||||||
</query>
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
<query id="updateSiteCounterUnique" action="update">
|
|
||||||
<tables>
|
|
||||||
<table name="counter_site_status" />
|
|
||||||
</tables>
|
|
||||||
<columns>
|
|
||||||
<column name="unique_visitor" default="plus(1)" />
|
|
||||||
<column name="pageview" default="plus(1)" />
|
|
||||||
</columns>
|
|
||||||
<conditions>
|
|
||||||
<condition operation="equal" column="site_srl" var="site_srl" notnull="notnull" />
|
|
||||||
<condition operation="in" column="regdate" var="regdate" notnull="notnull" pipe="and" />
|
|
||||||
</conditions>
|
|
||||||
</query>
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
<query id="updateSiteTotalCounterUnique" action="update">
|
|
||||||
<tables>
|
|
||||||
<table name="counter_site_status" />
|
|
||||||
</tables>
|
|
||||||
<columns>
|
|
||||||
<column name="unique_visitor" default="plus(1)" />
|
|
||||||
<column name="pageview" default="plus(1)" />
|
|
||||||
</columns>
|
|
||||||
<conditions>
|
|
||||||
<condition operation="equal" column="site_srl" var="site_srl" notnull="notnull" />
|
|
||||||
<condition operation="equal" column="regdate" default="00000000" notnull="notnull" pipe="and" />
|
|
||||||
</conditions>
|
|
||||||
</query>
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
||||||
<table name="counter_site_status">
|
|
||||||
<column name="site_srl" type="number" size="11" notnull="notnull" unique="site_status" />
|
|
||||||
<column name="regdate" type="number" size="11" notnull="notnull" unique="site_status" />
|
|
||||||
<column name="unique_visitor" type="number" size="11" default="0" />
|
|
||||||
<column name="pageview" type="number" size="11" default="0" />
|
|
||||||
</table>
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue