|
1
|
|
|
<?php |
|
2
|
|
|
/* Copyright (C) NAVER <http://www.navercorp.com> */ |
|
3
|
|
|
/** |
|
4
|
|
|
* @class module |
|
5
|
|
|
* @author NAVER ([email protected]) |
|
6
|
|
|
* @brief high class of the module module |
|
7
|
|
|
*/ |
|
8
|
|
|
class module extends ModuleObject |
|
9
|
|
|
{ |
|
10
|
|
|
/** |
|
11
|
|
|
* @brief Implement if additional tasks are necessary when installing |
|
12
|
|
|
*/ |
|
13
|
|
|
function moduleInstall() |
|
14
|
|
|
{ |
|
15
|
|
|
// Register action forward (to use in administrator mode) |
|
16
|
|
|
$oModuleController = getController('module'); |
|
|
|
|
|
|
17
|
|
|
|
|
18
|
|
|
$oDB = &DB::getInstance(); |
|
19
|
|
|
$oDB->addIndex("modules","idx_site_mid", array("site_srl","mid"), true); |
|
20
|
|
|
$oDB->addIndex('sites','unique_domain',array('domain'),true); |
|
21
|
|
|
// Create a directory to use in the module module |
|
22
|
|
|
FileHandler::makeDir('./files/cache/module_info'); |
|
23
|
|
|
FileHandler::makeDir('./files/cache/triggers'); |
|
24
|
|
|
FileHandler::makeDir('./files/ruleset'); |
|
25
|
|
|
|
|
26
|
|
|
// Insert site information into the sites table |
|
27
|
|
|
$args = new stdClass; |
|
28
|
|
|
$args->site_srl = 0; |
|
29
|
|
|
$output = $oDB->executeQuery('module.getSite', $args); |
|
30
|
|
View Code Duplication |
if(!$output->data || !$output->data->index_module_srl) |
|
31
|
|
|
{ |
|
32
|
|
|
$db_info = Context::getDBInfo(); |
|
33
|
|
|
$domain = Context::getDefaultUrl(); |
|
34
|
|
|
$url_info = parse_url($domain); |
|
35
|
|
|
$domain = $url_info['host'].( (!empty($url_info['port'])&&$url_info['port']!=80)?':'.$url_info['port']:'').$url_info['path']; |
|
36
|
|
|
|
|
37
|
|
|
$site_args = new stdClass; |
|
38
|
|
|
$site_args->site_srl = 0; |
|
39
|
|
|
$site_args->index_module_srl = 0; |
|
40
|
|
|
$site_args->domain = $domain; |
|
41
|
|
|
$site_args->default_language = $db_info->lang_type; |
|
42
|
|
|
|
|
43
|
|
|
$output = executeQuery('module.insertSite', $site_args); |
|
44
|
|
|
if(!$output->toBool()) return $output; |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
|
return new Object(); |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
/** |
|
51
|
|
|
* @brief a method to check if successfully installed |
|
52
|
|
|
*/ |
|
53
|
|
|
function checkUpdate() |
|
54
|
|
|
{ |
|
55
|
|
|
$oDB = &DB::getInstance(); |
|
56
|
|
|
// 2008. 10. 27 Add multi-index in the table, the module_part_config |
|
57
|
|
|
if(!$oDB->isIndexExists("module_part_config","idx_module_part_config")) return true; |
|
58
|
|
|
// 2008. 11. 13 Delete unique constraint on mid in modules. Add site_srl and then create unique index on site_srl and mid |
|
59
|
|
|
if(!$oDB->isIndexExists('modules',"idx_site_mid")) return true; |
|
60
|
|
|
// Move permissions/skin information of all modules to the table, grants. |
|
61
|
|
|
if($oDB->isColumnExists('modules', 'grants')) return true; |
|
62
|
|
|
// Move permissions/skin information of all modules to the table, grants. |
|
63
|
|
|
if(!$oDB->isColumnExists('sites', 'default_language')) return true; |
|
64
|
|
|
// Delete extra_vars* column |
|
65
|
|
|
for($i=1;$i<=20;$i++) |
|
66
|
|
|
{ |
|
67
|
|
|
if($oDB->isColumnExists("documents","extra_vars".$i)) return true; |
|
68
|
|
|
} |
|
69
|
|
|
// Insert site information to the table, sites |
|
70
|
|
|
$args = new stdClass(); |
|
71
|
|
|
$args->site_srl = 0; |
|
72
|
|
|
$output = $oDB->executeQuery('module.getSite', $args); |
|
73
|
|
|
if(!$output->data) return true; |
|
74
|
|
|
|
|
75
|
|
|
// If domain index is defined on the table, sites |
|
76
|
|
|
if($oDB->isIndexExists('sites', 'idx_domain')) return true; |
|
77
|
|
|
if(!$oDB->isIndexExists('sites','unique_domain')) return true; |
|
78
|
|
|
|
|
79
|
|
|
if(!$oDB->isColumnExists("modules", "use_mobile")) return true; |
|
80
|
|
|
if(!$oDB->isColumnExists("modules", "mlayout_srl")) return true; |
|
81
|
|
|
if(!$oDB->isColumnExists("modules", "mcontent")) return true; |
|
82
|
|
|
if(!$oDB->isColumnExists("modules", "mskin")) return true; |
|
83
|
|
|
|
|
84
|
|
|
// check fix skin |
|
85
|
|
|
if(!$oDB->isColumnExists("modules", "is_skin_fix")) return true; |
|
86
|
|
|
|
|
87
|
|
|
if(!$oDB->isColumnExists("module_config", "site_srl")) return true; |
|
88
|
|
|
|
|
89
|
|
|
if(!is_dir('./files/ruleset')) return true; |
|
90
|
|
|
|
|
91
|
|
|
$args->skin = '.'; |
|
92
|
|
|
$output = executeQueryArray('module.getModuleSkinDotList', $args); |
|
93
|
|
View Code Duplication |
if($output->data && count($output->data) > 0) |
|
94
|
|
|
{ |
|
95
|
|
|
foreach($output->data as $item) |
|
96
|
|
|
{ |
|
97
|
|
|
$skin_path = explode('.', $item->skin); |
|
98
|
|
|
if(count($skin_path) != 2) continue; |
|
99
|
|
|
if(is_dir(sprintf(_XE_PATH_ . 'themes/%s/modules/%s', $skin_path[0], $skin_path[1]))) return true; |
|
100
|
|
|
} |
|
101
|
|
|
} |
|
102
|
|
|
|
|
103
|
|
|
// XE 1.7 |
|
104
|
|
|
|
|
105
|
|
|
// check fix mskin |
|
106
|
|
|
if(!$oDB->isColumnExists("modules", "is_mskin_fix")) return true; |
|
107
|
|
|
|
|
108
|
|
|
$oModuleModel = getModel('module'); |
|
109
|
|
|
$moduleConfig = $oModuleModel->getModuleConfig('module'); |
|
110
|
|
|
if(!$moduleConfig->isUpdateFixedValue) return true; |
|
111
|
|
|
} |
|
112
|
|
|
|
|
113
|
|
|
/** |
|
114
|
|
|
* @brief Execute update |
|
115
|
|
|
*/ |
|
116
|
|
|
function moduleUpdate() |
|
117
|
|
|
{ |
|
118
|
|
|
$oDB = &DB::getInstance(); |
|
119
|
|
|
// 2008. 10. 27 module_part_config Add a multi-index to the table and check all information of module_configg |
|
120
|
|
|
if(!$oDB->isIndexExists("module_part_config","idx_module_part_config")) |
|
121
|
|
|
{ |
|
122
|
|
|
$oModuleModel = getModel('module'); |
|
123
|
|
|
$oModuleController = getController('module'); |
|
124
|
|
|
$modules = $oModuleModel->getModuleList(); |
|
125
|
|
|
foreach($modules as $key => $module_info) |
|
126
|
|
|
{ |
|
127
|
|
|
$module = $module_info->module; |
|
128
|
|
|
if(!in_array($module, array('point','trackback','layout','rss','file','comment','editor'))) continue; |
|
129
|
|
|
$config = $oModuleModel->getModuleConfig($module); |
|
130
|
|
|
|
|
131
|
|
|
$module_config = null; |
|
132
|
|
|
switch($module) |
|
133
|
|
|
{ |
|
134
|
|
|
case 'point' : |
|
135
|
|
|
$module_config = $config->module_point; |
|
136
|
|
|
unset($config->module_point); |
|
137
|
|
|
break; |
|
138
|
|
|
case 'trackback' : |
|
139
|
|
|
case 'rss' : |
|
140
|
|
|
case 'file' : |
|
141
|
|
|
case 'comment' : |
|
142
|
|
|
case 'editor' : |
|
143
|
|
|
$module_config = $config->module_config; |
|
144
|
|
|
unset($config->module_config); |
|
145
|
|
|
if(is_array($module_config) && count($module_config)) |
|
146
|
|
|
{ |
|
147
|
|
|
foreach($module_config as $key => $val) |
|
148
|
|
|
{ |
|
149
|
|
|
if(isset($module_config[$key]->module_srl)) unset($module_config[$key]->module_srl); |
|
150
|
|
|
} |
|
151
|
|
|
} |
|
152
|
|
|
break; |
|
153
|
|
|
case 'layout' : |
|
154
|
|
|
$tmp = $config->header_script; |
|
155
|
|
|
if(is_array($tmp) && count($tmp)) |
|
156
|
|
|
{ |
|
157
|
|
|
foreach($tmp as $k => $v) |
|
158
|
|
|
{ |
|
159
|
|
|
if(!$v && !trim($v)) continue; |
|
160
|
|
|
$module_config[$k]->header_script = $v; |
|
161
|
|
|
} |
|
162
|
|
|
} |
|
163
|
|
|
$config = null; |
|
164
|
|
|
break; |
|
165
|
|
|
} |
|
166
|
|
|
|
|
167
|
|
|
$oModuleController->insertModuleConfig($module, $config); |
|
168
|
|
|
|
|
169
|
|
|
if(is_array($module_config) && count($module_config)) |
|
170
|
|
|
{ |
|
171
|
|
|
foreach($module_config as $module_srl => $module_part_config) |
|
172
|
|
|
{ |
|
173
|
|
|
$oModuleController->insertModulePartConfig($module,$module_srl,$module_part_config); |
|
174
|
|
|
} |
|
175
|
|
|
} |
|
176
|
|
|
} |
|
177
|
|
|
$oDB->addIndex("module_part_config","idx_module_part_config", array("module","module_srl")); |
|
178
|
|
|
} |
|
179
|
|
|
// 2008. 11. 13 drop index(unique_mid). Add a column and index on site_srl and mid columns |
|
180
|
|
|
if(!$oDB->isIndexExists('modules',"idx_site_mid")) |
|
181
|
|
|
{ |
|
182
|
|
|
$oDB->dropIndex("modules","unique_mid",true); |
|
183
|
|
|
$oDB->addColumn('modules','site_srl','number',11,0,true); |
|
184
|
|
|
$oDB->addIndex("modules","idx_site_mid", array("site_srl","mid"),true); |
|
185
|
|
|
} |
|
186
|
|
|
// document extra vars |
|
187
|
|
|
if(!$oDB->isTableExists('document_extra_vars')) $oDB->createTableByXmlFile('./modules/document/schemas/document_extra_vars.xml'); |
|
|
|
|
|
|
188
|
|
|
|
|
189
|
|
|
if(!$oDB->isTableExists('document_extra_keys')) $oDB->createTableByXmlFile('./modules/document/schemas/document_extra_keys.xml'); |
|
|
|
|
|
|
190
|
|
|
// Move permission, skin info, extection info, admin ID of all modules to the table, grants |
|
191
|
|
|
if($oDB->isColumnExists('modules', 'grants')) |
|
192
|
|
|
{ |
|
193
|
|
|
$oModuleController = getController('module'); |
|
194
|
|
|
$oDocumentController = getController('document'); |
|
195
|
|
|
// Get a value of the current system language code |
|
196
|
|
|
$lang_code = Context::getLangType(); |
|
197
|
|
|
// Get module_info of all modules |
|
198
|
|
|
$output = executeQueryArray('module.getModuleInfos'); |
|
199
|
|
|
if(count($output->data)) |
|
200
|
|
|
{ |
|
201
|
|
|
foreach($output->data as $module_info) |
|
202
|
|
|
{ |
|
203
|
|
|
// Separate information about permission granted to the module, extra vars, skin vars, super-admin's authority |
|
204
|
|
|
$module_srl = trim($module_info->module_srl); |
|
205
|
|
|
// grant an authority |
|
206
|
|
|
$grants = unserialize($module_info->grants); |
|
207
|
|
|
if($grants) $oModuleController->insertModuleGrants($module_srl, $grants); |
|
208
|
|
|
// Insert skin vars |
|
209
|
|
|
$skin_vars = unserialize($module_info->skin_vars); |
|
210
|
|
|
if($skin_vars) $oModuleController->insertModuleSkinVars($module_srl, $skin_vars); |
|
211
|
|
|
// Insert super admin's ID |
|
212
|
|
|
$admin_id = trim($module_info->admin_id); |
|
213
|
|
View Code Duplication |
if($admin_id && $admin_id != 'Array') |
|
214
|
|
|
{ |
|
215
|
|
|
$admin_ids = explode(',',$admin_id); |
|
216
|
|
|
if(count($admin_id)) |
|
217
|
|
|
{ |
|
218
|
|
|
foreach($admin_ids as $admin_id) |
|
219
|
|
|
{ |
|
220
|
|
|
$oModuleController->insertAdminId($module_srl, $admin_id); |
|
221
|
|
|
} |
|
222
|
|
|
} |
|
223
|
|
|
} |
|
224
|
|
|
// Save extra configurations for each module(column data which doesn't exist in the defaut modules) |
|
225
|
|
|
$extra_vars = unserialize($module_info->extra_vars); |
|
226
|
|
|
$document_extra_keys = null; |
|
227
|
|
|
if($extra_vars->extra_vars && count($extra_vars->extra_vars)) |
|
228
|
|
|
{ |
|
229
|
|
|
$document_extra_keys = $extra_vars->extra_vars; |
|
230
|
|
|
unset($extra_vars->extra_vars); |
|
231
|
|
|
} |
|
232
|
|
|
if($extra_vars) $oModuleController->insertModuleExtraVars($module_srl, $extra_vars); |
|
233
|
|
|
|
|
234
|
|
|
/** |
|
235
|
|
|
* Move document extra vars(it should have conducted in the documents module however extra vars in modules table should be listed up in this module) |
|
236
|
|
|
*/ |
|
237
|
|
|
// Insert extra vars if planet module is |
|
238
|
|
|
if($module_info->module == 'planet') |
|
239
|
|
|
{ |
|
240
|
|
|
if(!$document_extra_keys || !is_array($document_extra_keys)) $document_extra_keys = array(); |
|
241
|
|
|
$planet_extra_keys->name = 'postscript'; |
|
|
|
|
|
|
242
|
|
|
$planet_extra_keys->type = 'text'; |
|
243
|
|
|
$planet_extra_keys->is_required = 'N'; |
|
244
|
|
|
$planet_extra_keys->search = 'N'; |
|
245
|
|
|
$planet_extra_keys->default = ''; |
|
246
|
|
|
$planet_extra_keys->desc = ''; |
|
247
|
|
|
$document_extra_keys[20] = $planet_extra_keys; |
|
248
|
|
|
} |
|
249
|
|
|
// Register keys for document extra vars |
|
250
|
|
|
if(count($document_extra_keys)) |
|
251
|
|
|
{ |
|
252
|
|
View Code Duplication |
foreach($document_extra_keys as $var_idx => $val) |
|
253
|
|
|
{ |
|
254
|
|
|
$oDocumentController->insertDocumentExtraKey($module_srl, $var_idx, $val->name, $val->type, $val->is_required, $val->search, $val->default, $val->desc, 'extra_vars'.$var_idx); |
|
255
|
|
|
} |
|
256
|
|
|
// 2009-04-14 Fixed a bug that only 100 extra vars are moved |
|
257
|
|
|
$oDocumentModel = getModel('document'); |
|
258
|
|
|
$total_count = $oDocumentModel->getDocumentCount($module_srl); |
|
259
|
|
|
|
|
260
|
|
|
if($total_count > 0) |
|
261
|
|
|
{ |
|
262
|
|
|
$per_page = 100; |
|
263
|
|
|
$total_pages = (int) (($total_count - 1) / $per_page) + 1; |
|
264
|
|
|
// Get extra vars if exist |
|
265
|
|
|
$doc_args = null; |
|
266
|
|
|
$doc_args->module_srl = $module_srl; |
|
267
|
|
|
$doc_args->list_count = $per_page; |
|
268
|
|
|
$doc_args->sort_index = 'list_order'; |
|
269
|
|
|
$doc_args->order_type = 'asc'; |
|
270
|
|
|
|
|
271
|
|
|
for($doc_args->page = 1; $doc_args->page <= $total_pages; $doc_args->page++) |
|
272
|
|
|
{ |
|
273
|
|
|
$output = executeQueryArray('document.getDocumentList', $doc_args); |
|
274
|
|
|
|
|
275
|
|
|
if($output->toBool() && $output->data && count($output->data)) |
|
276
|
|
|
{ |
|
277
|
|
|
foreach ($output->data as $document) |
|
278
|
|
|
{ |
|
279
|
|
|
if(!$document) continue; |
|
280
|
|
|
foreach ($document as $key => $var) |
|
281
|
|
|
{ |
|
282
|
|
|
if (strpos($key, 'extra_vars') !== 0 || !trim($var) || $var == 'N;') continue; |
|
283
|
|
|
$var_idx = str_replace('extra_vars','',$key); |
|
284
|
|
|
$oDocumentController->insertDocumentExtraVar($module_srl, $document->document_srl, $var_idx, $var, 'extra_vars'.$var_idx, $lang_code); |
|
285
|
|
|
} |
|
286
|
|
|
} |
|
287
|
|
|
} |
|
288
|
|
|
} // for total_pages |
|
289
|
|
|
} // if count |
|
290
|
|
|
} |
|
291
|
|
|
// Additional variables of the module, remove |
|
292
|
|
|
$module_info->grant = null; |
|
293
|
|
|
$module_info->extra_vars = null; |
|
294
|
|
|
$module_info->skin_vars = null; |
|
295
|
|
|
$module_info->admin_id = null; |
|
296
|
|
|
executeQuery('module.updateModule', $module_info); |
|
297
|
|
|
|
|
298
|
|
|
$oCacheHandler = CacheHandler::getInstance('object', null, true); |
|
299
|
|
|
if($oCacheHandler->isSupport()) |
|
300
|
|
|
{ |
|
301
|
|
|
$oCacheHandler->invalidateGroupKey('site_and_module'); |
|
302
|
|
|
} |
|
303
|
|
|
} |
|
304
|
|
|
} |
|
305
|
|
|
// Various column drop |
|
306
|
|
|
$oDB->dropColumn('modules','grants'); |
|
307
|
|
|
$oDB->dropColumn('modules','admin_id'); |
|
308
|
|
|
$oDB->dropColumn('modules','skin_vars'); |
|
309
|
|
|
$oDB->dropColumn('modules','extra_vars'); |
|
310
|
|
|
} |
|
311
|
|
|
// Rights of all modules/skins transferring the information into a table Update grants |
|
312
|
|
|
if(!$oDB->isColumnExists('sites', 'default_language')) |
|
313
|
|
|
{ |
|
314
|
|
|
$oDB->addColumn('sites','default_language','varchar',255,0,false); |
|
315
|
|
|
} |
|
316
|
|
|
// extra_vars * Remove Column |
|
317
|
|
|
for($i=1;$i<=20;$i++) |
|
318
|
|
|
{ |
|
319
|
|
|
if(!$oDB->isColumnExists("documents","extra_vars".$i)) continue; |
|
320
|
|
|
$oDB->dropColumn('documents','extra_vars'.$i); |
|
321
|
|
|
} |
|
322
|
|
|
|
|
323
|
|
|
// Enter the main site information sites on the table |
|
324
|
|
|
$args = new stdClass; |
|
325
|
|
|
$args->site_srl = 0; |
|
326
|
|
|
$output = $oDB->executeQuery('module.getSite', $args); |
|
327
|
|
View Code Duplication |
if(!$output->data) |
|
328
|
|
|
{ |
|
329
|
|
|
// Basic mid, language Wanted |
|
330
|
|
|
$mid_output = $oDB->executeQuery('module.getDefaultMidInfo', $args); |
|
331
|
|
|
$db_info = Context::getDBInfo(); |
|
332
|
|
|
$domain = Context::getDefaultUrl(); |
|
333
|
|
|
$url_info = parse_url($domain); |
|
334
|
|
|
$domain = $url_info['host'].( (!empty($url_info['port'])&&$url_info['port']!=80)?':'.$url_info['port']:'').$url_info['path']; |
|
335
|
|
|
$site_args->site_srl = 0; |
|
|
|
|
|
|
336
|
|
|
$site_args->index_module_srl = $mid_output->data->module_srl; |
|
337
|
|
|
$site_args->domain = $domain; |
|
338
|
|
|
$site_args->default_language = $db_info->lang_type; |
|
339
|
|
|
|
|
340
|
|
|
$output = executeQuery('module.insertSite', $site_args); |
|
341
|
|
|
if(!$output->toBool()) return $output; |
|
342
|
|
|
} |
|
343
|
|
|
|
|
344
|
|
|
if($oDB->isIndexExists('sites','idx_domain')) |
|
345
|
|
|
{ |
|
346
|
|
|
$oDB->dropIndex('sites','idx_domain'); |
|
347
|
|
|
} |
|
348
|
|
|
if(!$oDB->isIndexExists('sites','unique_domain')) |
|
349
|
|
|
{ |
|
350
|
|
|
$this->updateForUniqueSiteDomain(); |
|
351
|
|
|
$oDB->addIndex('sites','unique_domain',array('domain'),true); |
|
352
|
|
|
} |
|
353
|
|
|
|
|
354
|
|
|
if(!$oDB->isColumnExists("modules", "use_mobile")) |
|
355
|
|
|
{ |
|
356
|
|
|
$oDB->addColumn('modules','use_mobile','char',1,'N'); |
|
357
|
|
|
} |
|
358
|
|
|
if(!$oDB->isColumnExists("modules", "mlayout_srl")) |
|
359
|
|
|
{ |
|
360
|
|
|
$oDB->addColumn('modules','mlayout_srl','number',11, 0); |
|
361
|
|
|
} |
|
362
|
|
|
if(!$oDB->isColumnExists("modules", "mcontent")) |
|
363
|
|
|
{ |
|
364
|
|
|
$oDB->addColumn('modules','mcontent','bigtext'); |
|
365
|
|
|
} |
|
366
|
|
|
if(!$oDB->isColumnExists("modules", "mskin")) |
|
367
|
|
|
{ |
|
368
|
|
|
$oDB->addColumn('modules','mskin','varchar',250); |
|
369
|
|
|
} |
|
370
|
|
|
if(!$oDB->isColumnExists("modules", "is_skin_fix")) |
|
371
|
|
|
{ |
|
372
|
|
|
$oDB->addColumn('modules', 'is_skin_fix', 'char', 1, 'N'); |
|
373
|
|
|
$output = executeQuery('module.updateSkinFixModules'); |
|
|
|
|
|
|
374
|
|
|
} |
|
375
|
|
|
if(!$oDB->isColumnExists("module_config", "site_srl")) |
|
376
|
|
|
{ |
|
377
|
|
|
$oDB->addColumn('module_config', 'site_srl', 'number', 11, 0, true); |
|
378
|
|
|
} |
|
379
|
|
|
FileHandler::makeDir('./files/ruleset'); |
|
380
|
|
|
|
|
381
|
|
|
$args->skin = '.'; |
|
382
|
|
|
$output = executeQueryArray('module.getModuleSkinDotList', $args); |
|
383
|
|
View Code Duplication |
if($output->data && count($output->data) > 0) |
|
384
|
|
|
{ |
|
385
|
|
|
foreach($output->data as $item) |
|
386
|
|
|
{ |
|
387
|
|
|
$skin_path = explode('.', $item->skin); |
|
388
|
|
|
if(count($skin_path) != 2) continue; |
|
389
|
|
|
if(is_dir(sprintf(_XE_PATH_ . 'themes/%s/modules/%s', $skin_path[0], $skin_path[1]))) |
|
390
|
|
|
{ |
|
391
|
|
|
unset($args); |
|
392
|
|
|
$args->skin = $item->skin; |
|
393
|
|
|
$args->new_skin = implode('|@|', $skin_path); |
|
394
|
|
|
$output = executeQuery('module.updateSkinAll', $args); |
|
395
|
|
|
} |
|
396
|
|
|
} |
|
397
|
|
|
} |
|
398
|
|
|
|
|
399
|
|
|
// XE 1.7 |
|
400
|
|
|
if(!$oDB->isColumnExists("modules", "is_mskin_fix")) |
|
401
|
|
|
{ |
|
402
|
|
|
$oDB->addColumn('modules', 'is_mskin_fix', 'char', 1, 'N'); |
|
403
|
|
|
$output = executeQuery('module.updateMobileSkinFixModules'); |
|
|
|
|
|
|
404
|
|
|
} |
|
405
|
|
|
|
|
406
|
|
|
$oModuleModel = getModel('module'); |
|
407
|
|
|
$moduleConfig = $oModuleModel->getModuleConfig('module'); |
|
408
|
|
|
if(!$moduleConfig->isUpdateFixedValue) |
|
409
|
|
|
{ |
|
410
|
|
|
$output = executeQuery('module.updateSkinFixModules'); |
|
|
|
|
|
|
411
|
|
|
$output = executeQuery('module.updateMobileSkinFixModules'); |
|
|
|
|
|
|
412
|
|
|
|
|
413
|
|
|
$oModuleController = getController('module'); |
|
414
|
|
|
if(!$moduleConfig) $moduleConfig = new stdClass; |
|
415
|
|
|
$moduleConfig->isUpdateFixedValue = TRUE; |
|
416
|
|
|
$output = $oModuleController->updateModuleConfig('module', $moduleConfig); |
|
|
|
|
|
|
417
|
|
|
} |
|
418
|
|
|
|
|
419
|
|
|
return new Object(0, 'success_updated'); |
|
420
|
|
|
} |
|
421
|
|
|
|
|
422
|
|
|
function updateForUniqueSiteDomain() |
|
423
|
|
|
{ |
|
424
|
|
|
$output = executeQueryArray("module.getNonuniqueDomains"); |
|
425
|
|
|
if(!$output->data) return; |
|
426
|
|
|
foreach($output->data as $data) |
|
427
|
|
|
{ |
|
428
|
|
|
if($data->count == 1) continue; |
|
429
|
|
|
$domain = $data->domain; |
|
430
|
|
|
$args = new stdClass; |
|
431
|
|
|
$args->domain = $domain; |
|
432
|
|
|
$output2 = executeQueryArray("module.getSiteByDomain", $args); |
|
433
|
|
|
$bFirst = true; |
|
434
|
|
|
foreach($output2->data as $site) |
|
435
|
|
|
{ |
|
436
|
|
|
if($bFirst) |
|
437
|
|
|
{ |
|
438
|
|
|
$bFirst = false; |
|
439
|
|
|
continue; |
|
440
|
|
|
} |
|
441
|
|
|
$domain .= "_"; |
|
442
|
|
|
$args = new stdClass; |
|
443
|
|
|
$args->domain = $domain; |
|
444
|
|
|
$args->site_srl = $site->site_srl; |
|
445
|
|
|
$output3 = executeQuery("module.updateSite", $args); |
|
|
|
|
|
|
446
|
|
|
} |
|
447
|
|
|
} |
|
448
|
|
|
} |
|
449
|
|
|
|
|
450
|
|
|
/** |
|
451
|
|
|
* @brief Re-generate the cache file |
|
452
|
|
|
*/ |
|
453
|
|
|
function recompileCache() |
|
454
|
|
|
{ |
|
455
|
|
|
$oModuleModel = getModel('module'); |
|
456
|
|
|
$oModuleModel->getModuleList(); |
|
457
|
|
|
$oModuleModel->loadModuleExtends(); |
|
458
|
|
|
} |
|
459
|
|
|
} |
|
460
|
|
|
/* End of file module.class.php */ |
|
461
|
|
|
/* Location: ./modules/module/module.class.php */ |
|
462
|
|
|
|
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVarassignment in line 1 and the$higherassignment in line 2 are dead. The first because$myVaris never used and the second because$higheris always overwritten for every possible time line.