rhymix/modules/counter/counter.class.php
Kijin Sung 84e5542d77 Remove unnecessary use of BaseObject
- 트리거 등 반환값이 필요하지 않은 곳에서 new BaseObject()를 반환하는 것 삭제
- 모듈 설치, 업데이트 후 무의미한 new BaseObject()를 반환하는 것 삭제
- 사용자에게 에러 메시지를 돌려주는 용도로 new BaseObject(-1, '에러메시지')를
  사용하는 경우는 대부분 $this->setError()로 변경함. 언어 변환과 sprintf()
  처리까지 한 번에 이루어지므로 이쪽이 더 편리함.
2017-12-01 00:54:51 +09:00

82 lines
1.5 KiB
PHP

<?php
/* Copyright (C) NAVER <http://www.navercorp.com> */
/**
* High class of counter module
*
* @author NAVER (developers@xpressengine.com)
*/
class counter extends ModuleObject
{
/**
* Implement if additional tasks are necessary when installing
* @return Object
*/
function moduleInstall()
{
$oCounterController = getController('counter');
// add a row for the total visit history
//$oCounterController->insertTotalStatus();
// add a row for today's status
//$oCounterController->insertTodayStatus();
}
/**
* method if successfully installed
*
* @return bool
*/
function checkUpdate()
{
// Add site_srl to the counter
$oDB = DB::getInstance();
if(!$oDB->isColumnExists('counter_log', 'site_srl'))
{
return TRUE;
}
if(!$oDB->isIndexExists('counter_log', 'idx_site_counter_log'))
{
return TRUE;
}
return FALSE;
}
/**
* Module update
*
* @return Object
*/
function moduleUpdate()
{
// Add site_srl to the counter
$oDB = DB::getInstance();
if(!$oDB->isColumnExists('counter_log', 'site_srl'))
{
$oDB->addColumn('counter_log', 'site_srl', 'number', 11, 0, TRUE);
}
if(!$oDB->isIndexExists('counter_log', 'idx_site_counter_log'))
{
$oDB->addIndex('counter_log', 'idx_site_counter_log', array('site_srl', 'ipaddress'), FALSE);
}
}
/**
* re-generate the cache file
*
* @return Object
*/
function recompileCache()
{
}
}
/* End of file counter.class.php */
/* Location: ./modules/counter/counter.class.php */