XpressEngine Core  1.11.2
 All Classes Namespaces Files Functions Variables Pages
counter.class.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) NAVER <http://www.navercorp.com> */
3 
9 class counter extends ModuleObject
10 {
11 
16  function moduleInstall()
17  {
18  $oCounterController = getController('counter');
19 
20  // add a row for the total visit history
21  //$oCounterController->insertTotalStatus();
22 
23  // add a row for today's status
24  //$oCounterController->insertTodayStatus();
25 
26  return new BaseObject();
27  }
28 
34  function checkUpdate()
35  {
36  // Add site_srl to the counter
37  $oDB = DB::getInstance();
38  $oModuleModel = getModel('module');
40  $version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated'));
41  if($oModuleModel->needUpdate($version_update_id))
42  {
43  if(!$oDB->isColumnExists('counter_log', 'site_srl'))
44  {
45  return TRUE;
46  }
47 
48  if(!$oDB->isIndexExists('counter_log', 'idx_site_counter_log'))
49  {
50  return TRUE;
51  }
52 
53  $oModuleController->insertUpdatedLog($version_update_id);
54  }
55 
56  return FALSE;
57  }
58 
64  function moduleUpdate()
65  {
66  // Add site_srl to the counter
67  $oDB = DB::getInstance();
68 
69  $oModuleModel = getModel('module');
71  $version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated'));
72  if($oModuleModel->needUpdate($version_update_id))
73  {
74  if(!$oDB->isColumnExists('counter_log', 'site_srl'))
75  {
76  $oDB->addColumn('counter_log', 'site_srl', 'number', 11, 0, TRUE);
77  }
78 
79  if(!$oDB->isIndexExists('counter_log', 'idx_site_counter_log'))
80  {
81  $oDB->addIndex('counter_log', 'idx_site_counter_log', array('site_srl', 'ipaddress'), FALSE);
82  }
83 
84  $oModuleController->insertUpdatedLog($version_update_id);
85  }
86 
87  return new BaseObject(0, 'success_updated');
88  }
89 
95  function recompileCache()
96  {
97 
98  }
99 
100 }
101 /* End of file counter.class.php */
102 /* Location: ./modules/counter/counter.class.php */
$oModuleModel
Definition: ko.install.php:236
getController($module_name)
Definition: func.inc.php:90
const __XE_VERSION__
Definition: config.inc.php:32
recompileCache()
getInstance($db_type=NULL)
Definition: DB.class.php:142
getModel($module_name)
Definition: func.inc.php:145
$oModuleController
Definition: ko.install.php:287