mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-02 08:42:15 +09:00
moduleModel 및 moduleController에서 제공하던 각 모듈별 설정을 이용시 너무 많은 설정값들이 생길 경우 이를 serialize/ unserialize하는데 드는 부하가 커짐을 방지하기 위해서 module_config외에 module_part_config 테이블을 주고 module_srl 별 설정을 분산하도록 하여 쓸데없는 부하가 생기지 않도록 수정.
files/cache/module_info내에 있던 module_config 캐시 파일도 사용하지 않도록 변경 git-svn-id: http://xe-core.googlecode.com/svn/sandbox@4696 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
cc7dd67ed2
commit
5934906056
41 changed files with 372 additions and 445 deletions
|
|
@ -18,6 +18,9 @@
|
|||
$oModuleController->insertActionForward('module', 'view', 'dispModuleAdminCategory');
|
||||
$oModuleController->insertActionForward('module', 'view', 'dispModuleAdminInfo');
|
||||
|
||||
$oDB = &DB::getInstance();
|
||||
$oDB->addIndex("module_part_config","idx_module_part_config", array("module","module_srl"));
|
||||
|
||||
// module 모듈에서 사용할 디렉토리 생성
|
||||
FileHandler::makeDir('./files/cache/module_info');
|
||||
FileHandler::makeDir('./files/cache/triggers');
|
||||
|
|
@ -29,6 +32,11 @@
|
|||
* @brief 설치가 이상이 없는지 체크하는 method
|
||||
**/
|
||||
function checkUpdate() {
|
||||
$oDB = &DB::getInstance();
|
||||
|
||||
// 2008. 10. 27 module_part_config 테이블의 결합 인덱스 추가
|
||||
if(!$oDB->isIndexExists("module_part_config","idx_module_part_config")) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -36,6 +44,61 @@
|
|||
* @brief 업데이트 실행
|
||||
**/
|
||||
function moduleUpdate() {
|
||||
$oDB = &DB::getInstance();
|
||||
|
||||
// 2008. 10. 27 module_part_config 테이블의 결합 인덱스 추가하고 기존에 module_config에 몰려 있던 모든 정보를 재점검
|
||||
if(!$oDB->isIndexExists("module_part_config","idx_module_part_config")) {
|
||||
$oModuleModel = &getModel('module');
|
||||
$oModuleController = &getController('module');
|
||||
$modules = $oModuleModel->getModuleList();
|
||||
foreach($modules as $key => $module_info) {
|
||||
$module = $module_info->module;
|
||||
if(!in_array($module, array('point','trackback','layout','rss','file','comment','editor'))) continue;
|
||||
$config = $oModuleModel->getModuleConfig($module);
|
||||
|
||||
$module_config = null;
|
||||
switch($module) {
|
||||
case 'point' :
|
||||
$module_config = $config->module_point;
|
||||
unset($config->module_point);
|
||||
break;
|
||||
case 'trackback' :
|
||||
case 'rss' :
|
||||
case 'file' :
|
||||
case 'comment' :
|
||||
case 'editor' :
|
||||
$module_config = $config->module_config;
|
||||
unset($config->module_config);
|
||||
if(is_array($module_config) && count($module_config)) {
|
||||
foreach($module_config as $key => $val) {
|
||||
if(isset($module_config[$key]->module_srl)) unset($module_config[$key]->module_srl);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'layout' :
|
||||
$tmp = $config->header_script;
|
||||
if(is_array($tmp) && count($tmp)) {
|
||||
foreach($tmp as $k => $v) {
|
||||
if(!$v && !trim($v)) continue;
|
||||
$module_config[$k]->header_script = $v;
|
||||
}
|
||||
}
|
||||
$config = null;
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
$oModuleController->insertModuleConfig($module, $config);
|
||||
|
||||
if(is_array($module_config) && count($module_config)) {
|
||||
foreach($module_config as $module_srl => $module_part_config) {
|
||||
$oModuleController->insertModulePartConfig($module,$module_srl,$module_part_config);
|
||||
}
|
||||
}
|
||||
}
|
||||
$oDB->addIndex("module_part_config","idx_module_part_config", array("module","module_srl"));
|
||||
}
|
||||
|
||||
return new Object();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -47,27 +47,37 @@
|
|||
return $output;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief 모듈의 기본 정보 입력
|
||||
* 모듈의 정보를 입력받은 데이터를 serialize하여 등록한다.
|
||||
* @brief 특정 모듈의 설정 입력
|
||||
* board, member등 특정 모듈의 global config 관리용
|
||||
**/
|
||||
function insertModuleConfig($module, $config) {
|
||||
// 변수 정리
|
||||
$args->module = $module;
|
||||
$args->config = serialize($config);
|
||||
|
||||
// 일단 삭제 (캐쉬 파일도 지운다)
|
||||
$output = executeQuery('module.deleteModuleConfig', $args);
|
||||
if(!$output->toBool()) return $output;
|
||||
|
||||
FileHandler::removeFile( sprintf('./files/cache/module_info/%s.config.php',$module) );
|
||||
|
||||
// 변수 정리후 query 실행
|
||||
$output = executeQuery('module.insertModuleConfig', $args);
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 특정 mid의 모듈 설정 정보 저장
|
||||
* mid의 모듈 의존적인 설정을 관리
|
||||
**/
|
||||
function insertModulePartConfig($module, $module_srl, $config) {
|
||||
$args->module = $module;
|
||||
$args->module_srl = $module_srl;
|
||||
$args->config = serialize($config);
|
||||
|
||||
$output = executeQuery('module.deleteModulePartConfig', $args);
|
||||
if(!$output->toBool()) return $output;
|
||||
|
||||
$output = executeQuery('module.insertModulePartConfig', $args);
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 모듈 입력
|
||||
**/
|
||||
|
|
|
|||
|
|
@ -575,31 +575,48 @@
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief 특정 모듈의 설정 정보 return
|
||||
* 캐시된 설정 정보가 없으면 만들 후 캐시하고 return
|
||||
* @brief 특정 모듈의 설정 return
|
||||
* board, member등 특정 모듈의 global config 관리용
|
||||
**/
|
||||
function getModuleConfig($module) {
|
||||
if(!$GLOBALS['__ModuleConfig__'][$module]) {
|
||||
$cache_file = sprintf('./files/cache/module_info/%s.config.php',$module);
|
||||
|
||||
if(!file_exists($cache_file)) {
|
||||
$args->module = $module;
|
||||
$output = executeQuery('module.getModuleConfig', $args);
|
||||
|
||||
$config = base64_encode($output->data->config);
|
||||
|
||||
$buff = sprintf('<?php if(!defined("__ZBXE__")) exit(); $config = "%s"; ?>', $config);
|
||||
|
||||
FileHandler::writeFile($cache_file, $buff);
|
||||
}
|
||||
|
||||
if(!$config && file_exists($cache_file)) @include($cache_file);
|
||||
|
||||
$GLOBALS['__ModuleConfig__'][$module] = unserialize(base64_decode($config));
|
||||
$args->module = $module;
|
||||
$output = executeQuery('module.getModuleConfig', $args);
|
||||
$config = unserialize($output->data->config);
|
||||
$GLOBALS['__ModuleConfig__'][$module] = $config;
|
||||
}
|
||||
return $GLOBALS['__ModuleConfig__'][$module];
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 특정 mid의 모듈 설정 정보 return
|
||||
* mid의 모듈 의존적인 설정을 관리
|
||||
**/
|
||||
function getModulePartConfig($module, $module_srl) {
|
||||
if(!$GLOBALS['__ModulePartConfig__'][$module][$module_srl]) {
|
||||
$args->module = $module;
|
||||
$args->module_srl = $module_srl;
|
||||
$output = executeQuery('module.getModulePartConfig', $args);
|
||||
$config = unserialize($output->data->config);
|
||||
$GLOBALS['__ModulePartConfig__'][$module][$module_srl] = $config;
|
||||
}
|
||||
return $GLOBALS['__ModulePartConfig__'][$module][$module_srl];
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief mid별 모듈 설정 정보 전체를 구함
|
||||
**/
|
||||
function getModulePartConfigs($module) {
|
||||
$args->module = $module;
|
||||
$output = executeQueryArray('module.getModulePartConfigs', $args);
|
||||
if(!$output->toBool() || !$output->data) return array();
|
||||
|
||||
foreach($output->data as $key => $val) {
|
||||
$result[$val->module_srl] = unserialize($val->config);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief 모듈의 conf/info.xml 을 읽어서 정보를 구함
|
||||
|
|
|
|||
9
modules/module/queries/deleteModulePartConfig.xml
Normal file
9
modules/module/queries/deleteModulePartConfig.xml
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<query id="deleteModulePartConfig" action="delete">
|
||||
<tables>
|
||||
<table name="module_part_config" />
|
||||
</tables>
|
||||
<conditions>
|
||||
<condition operation="equal" column="module" var="module" notnull="notnull" />
|
||||
<condition operation="equal" column="module_srl" var="module_srl" notnull="notnull" pipe="and"/>
|
||||
</conditions>
|
||||
</query>
|
||||
12
modules/module/queries/getModulePartConfig.xml
Normal file
12
modules/module/queries/getModulePartConfig.xml
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
<query id="getModulePartConfig" action="select">
|
||||
<tables>
|
||||
<table name="module_part_config" />
|
||||
</tables>
|
||||
<columns>
|
||||
<column name="config" />
|
||||
</columns>
|
||||
<conditions>
|
||||
<condition operation="equal" column="module" var="module" notnull="notnull" />
|
||||
<condition operation="equal" column="module_srl" var="module_srl" notnull="notnull" pipe="and" />
|
||||
</conditions>
|
||||
</query>
|
||||
12
modules/module/queries/getModulePartConfigs.xml
Normal file
12
modules/module/queries/getModulePartConfigs.xml
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
<query id="getModulePartConfigs" action="select">
|
||||
<tables>
|
||||
<table name="module_part_config" />
|
||||
</tables>
|
||||
<columns>
|
||||
<column name="module_srl" />
|
||||
<column name="config" />
|
||||
</columns>
|
||||
<conditions>
|
||||
<condition operation="equal" column="module" var="module" notnull="notnull" />
|
||||
</conditions>
|
||||
</query>
|
||||
11
modules/module/queries/insertModulePartConfig.xml
Normal file
11
modules/module/queries/insertModulePartConfig.xml
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<query id="insertModulePartConfig" action="insert">
|
||||
<tables>
|
||||
<table name="module_part_config" />
|
||||
</tables>
|
||||
<columns>
|
||||
<column name="module" var="module" notnull="notnull" />
|
||||
<column name="module_srl" var="module_srl" notnull="notnull" />
|
||||
<column name="config" var="config" />
|
||||
<column name="regdate" default="curdate()" />
|
||||
</columns>
|
||||
</query>
|
||||
6
modules/module/schemas/module_part_config.xml
Normal file
6
modules/module/schemas/module_part_config.xml
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
<table name="module_part_config">
|
||||
<column name="module" type="varchar" size="250" notnull="notnull" />
|
||||
<column name="module_srl" type="number" size="11" notnull="notnull" />
|
||||
<column name="config" type="text" />
|
||||
<column name="regdate" type="date" />
|
||||
</table>
|
||||
Loading…
Add table
Add a link
Reference in a new issue