XpressEngine Core  1.11.2
 All Classes Namespaces Files Functions Variables Pages
tag.class.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) NAVER <http://www.navercorp.com> */
8 class tag extends ModuleObject
9 {
13  function moduleInstall()
14  {
16  $oDB = &DB::getInstance();
17 
18  $oDB->addIndex("tags","idx_tag", array("document_srl","tag"));
19  // 2007. 10. 17 document.insertDocument, updateDocument, deleteDocument trigger property for
20  $oModuleController->insertTrigger('document.insertDocument', 'tag', 'controller', 'triggerArrangeTag', 'before');
21  $oModuleController->insertTrigger('document.insertDocument', 'tag', 'controller', 'triggerInsertTag', 'after');
22  $oModuleController->insertTrigger('document.updateDocument', 'tag', 'controller', 'triggerArrangeTag', 'before');
23  $oModuleController->insertTrigger('document.updateDocument', 'tag', 'controller', 'triggerInsertTag', 'after');
24  $oModuleController->insertTrigger('document.deleteDocument', 'tag', 'controller', 'triggerDeleteTag', 'after');
25  // 2007. 10. 17 modules are deleted when you delete all registered triggers that add tag
26  $oModuleController->insertTrigger('module.deleteModule', 'tag', 'controller', 'triggerDeleteModuleTags', 'after');
27 
28  return new BaseObject();
29  }
30 
34  function checkUpdate()
35  {
36  $oDB = &DB::getInstance();
37  $oModuleModel = getModel('module');
39  $version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated'));
40  if($oModuleModel->needUpdate($version_update_id))
41  {
42  // 2007. 10. 17 trigger registration, if registered upset
43  if(!$oModuleModel->getTrigger('document.insertDocument', 'tag', 'controller', 'triggerArrangeTag', 'before')) return true;
44  if(!$oModuleModel->getTrigger('document.insertDocument', 'tag', 'controller', 'triggerInsertTag', 'after')) return true;
45  if(!$oModuleModel->getTrigger('document.updateDocument', 'tag', 'controller', 'triggerArrangeTag', 'before')) return true;
46  if(!$oModuleModel->getTrigger('document.updateDocument', 'tag', 'controller', 'triggerInsertTag', 'after')) return true;
47  if(!$oModuleModel->getTrigger('document.deleteDocument', 'tag', 'controller', 'triggerDeleteTag', 'after')) return true;
48  // 2007. 10. 17 modules are deleted when you delete all registered triggers that add tag
49  if(!$oModuleModel->getTrigger('module.deleteModule', 'tag', 'controller', 'triggerDeleteModuleTags', 'after')) return true;
50  // tag in the index column of the table tag
51  if(!$oDB->isIndexExists("tags","idx_tag")) return true;
52 
53  $oModuleController->insertUpdatedLog($version_update_id);
54  }
55 
56  return false;
57  }
58 
62  function moduleUpdate()
63  {
64  $oDB = &DB::getInstance();
65  $oModuleModel = getModel('module');
67  $version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated'));
68  if($oModuleModel->needUpdate($version_update_id))
69  {
70  // 2007. 10. 17 document.insertDocument, updateDocument, deleteDocument trigger property for
71  if(!$oModuleModel->getTrigger('document.insertDocument', 'tag', 'controller', 'triggerArrangeTag', 'before'))
72  $oModuleController->insertTrigger('document.insertDocument', 'tag', 'controller', 'triggerArrangeTag', 'before');
73 
74  if(!$oModuleModel->getTrigger('document.insertDocument', 'tag', 'controller', 'triggerInsertTag', 'after'))
75  $oModuleController->insertTrigger('document.insertDocument', 'tag', 'controller', 'triggerInsertTag', 'after');
76 
77  if(!$oModuleModel->getTrigger('document.updateDocument', 'tag', 'controller', 'triggerArrangeTag', 'before'))
78  $oModuleController->insertTrigger('document.updateDocument', 'tag', 'controller', 'triggerArrangeTag', 'before');
79 
80  if(!$oModuleModel->getTrigger('document.updateDocument', 'tag', 'controller', 'triggerInsertTag', 'after'))
81  $oModuleController->insertTrigger('document.updateDocument', 'tag', 'controller', 'triggerInsertTag', 'after');
82 
83  if(!$oModuleModel->getTrigger('document.deleteDocument', 'tag', 'controller', 'triggerDeleteTag', 'after'))
84  $oModuleController->insertTrigger('document.deleteDocument', 'tag', 'controller', 'triggerDeleteTag', 'after');
85  // 2007. 10. 17 modules are deleted when you delete all registered triggers that add tag
86  if(!$oModuleModel->getTrigger('module.deleteModule', 'tag', 'controller', 'triggerDeleteModuleTags', 'after'))
87  $oModuleController->insertTrigger('module.deleteModule', 'tag', 'controller', 'triggerDeleteModuleTags', 'after');
88  // tag in the index column of the table tag
89  if(!$oDB->isIndexExists("tags","idx_tag"))
90  $oDB->addIndex("tags","idx_tag", array("document_srl","tag"));
91 
92  $oModuleController->insertUpdatedLog($version_update_id);
93  }
94 
95  return new BaseObject(0, 'success_updated');
96  }
97 
101  function recompileCache()
102  {
103  }
104 }
105 /* End of file tag.class.php */
106 /* Location: ./modules/tag/tag.class.php */
$oModuleModel
Definition: ko.install.php:236
getController($module_name)
Definition: func.inc.php:90
const __XE_VERSION__
Definition: config.inc.php:32
high class of the tag module
Definition: tag.class.php:8
recompileCache()
Re-generate the cache file.
Definition: tag.class.php:101
getInstance($db_type=NULL)
Definition: DB.class.php:142
getModel($module_name)
Definition: func.inc.php:145
$oModuleController
Definition: ko.install.php:287
moduleInstall()
Implement if additional tasks are necessary when installing.
Definition: tag.class.php:13
moduleUpdate()
Execute update.
Definition: tag.class.php:62
checkUpdate()
a method to check if successfully installed
Definition: tag.class.php:34