1
|
|
|
<?php |
2
|
|
|
/* Copyright (C) NAVER <http://www.navercorp.com> */ |
3
|
|
|
/** |
4
|
|
|
* The view class of the integration_search module |
5
|
|
|
* |
6
|
|
|
* @author NAVER ([email protected]) |
7
|
|
|
*/ |
8
|
|
|
class integration_search extends ModuleObject |
9
|
|
|
{ |
10
|
|
|
/** |
11
|
|
|
* Implement if additional tasks are necessary when installing |
12
|
|
|
* |
13
|
|
|
* @return Object |
14
|
|
|
*/ |
15
|
|
|
function moduleInstall() |
16
|
|
|
{ |
17
|
|
|
// Registered in action forward |
18
|
|
|
$oModuleController = getController('module'); |
19
|
|
|
$oModuleController->insertActionForward('integration_search', 'view', 'IS'); |
20
|
|
|
|
21
|
|
|
return new Object(); |
22
|
|
|
} |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* Check methoda whether successfully installed |
26
|
|
|
* |
27
|
|
|
* @return bool |
28
|
|
|
*/ |
29
|
|
View Code Duplication |
function checkUpdate() |
|
|
|
|
30
|
|
|
{ |
31
|
|
|
$oModuleModel = getModel('module'); |
32
|
|
|
$oModuleController = getController('module'); |
33
|
|
|
$version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated')); |
34
|
|
|
if($oModuleModel->needUpdate($version_update_id)) |
35
|
|
|
{ |
36
|
|
|
$config = $oModuleModel->getModuleConfig('integration_search'); |
37
|
|
|
|
38
|
|
|
if($config->skin) |
39
|
|
|
{ |
40
|
|
|
$config_parse = explode('.', $config->skin); |
41
|
|
|
if(count($config_parse) > 1) |
42
|
|
|
{ |
43
|
|
|
$template_path = sprintf('./themes/%s/modules/integration_search/', $config_parse[0]); |
44
|
|
|
if(is_dir($template_path)) return true; |
45
|
|
|
} |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
$oModuleController->insertUpdatedLog($version_update_id); |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
return false; |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* Execute update |
56
|
|
|
* |
57
|
|
|
* @return Object |
58
|
|
|
*/ |
59
|
|
View Code Duplication |
function moduleUpdate() |
|
|
|
|
60
|
|
|
{ |
61
|
|
|
$oModuleModel = getModel('module'); |
62
|
|
|
$oModuleController = getController('module'); |
63
|
|
|
$version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated')); |
64
|
|
|
if($oModuleModel->needUpdate($version_update_id)) |
65
|
|
|
{ |
66
|
|
|
$config = $oModuleModel->getModuleConfig('message'); |
67
|
|
|
|
68
|
|
|
if($config->skin) |
69
|
|
|
{ |
70
|
|
|
$config_parse = explode('.', $config->skin); |
71
|
|
|
if(count($config_parse) > 1) |
72
|
|
|
{ |
73
|
|
|
$template_path = sprintf('./themes/%s/modules/integration_search/', $config_parse[0]); |
74
|
|
|
if(is_dir($template_path)) |
75
|
|
|
{ |
76
|
|
|
$config->skin = implode('|@|', $config_parse); |
77
|
|
|
$oModuleController = getController('module'); |
78
|
|
|
$oModuleController->updateModuleConfig('integration_search', $config); |
79
|
|
|
} |
80
|
|
|
} |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
$oModuleController->insertUpdatedLog($version_update_id); |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
return new Object(0, 'success_updated'); |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
/** |
90
|
|
|
* Re-generate the cache file |
91
|
|
|
* |
92
|
|
|
* @return void |
93
|
|
|
*/ |
94
|
|
|
function recompileCache() |
95
|
|
|
{ |
96
|
|
|
} |
97
|
|
|
} |
98
|
|
|
/* End of file integration_search.class.php */ |
99
|
|
|
/* Location: ./modules/integration_search/integration_search.class.php */ |
100
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.