mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-08 03:01:43 +09:00
#440 위젯 캐시 재생성시 lock파일을 이용하여 하나의 위젯에 대해선 1번의 캐시 재생성이 이루어지도록 로직 변경.
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@4283 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
889742d283
commit
b090d9cf0c
3 changed files with 62 additions and 34 deletions
|
|
@ -175,5 +175,44 @@
|
|||
return WidgetHandler::execute($widget, $vars, $this->include_info);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 특정 content내의 위젯을 다시 생성
|
||||
**/
|
||||
function recompileWidget($content) {
|
||||
// 언어 종류 가져옴
|
||||
$lang_list = Context::get('lang_supported');
|
||||
|
||||
// 위젯 캐시 sequence 를 가져옴
|
||||
preg_match_all('!<img([^\>]*)widget=([^\>]*?)\>!is', $content, $matches);
|
||||
|
||||
$cache_path = './files/cache/widget_cache/';
|
||||
|
||||
$oWidget = new WidgetHandler();
|
||||
$oXmlParser = new XmlParser();
|
||||
|
||||
for($i=0;$i<count($matches[1]);$i++) {
|
||||
$buff = $matches[0][$i];
|
||||
$xml_doc = $oXmlParser->parse(trim($buff));
|
||||
|
||||
$args = $xml_doc->img->attrs;
|
||||
if(!$args) continue;
|
||||
|
||||
// 캐싱하지 않을 경우 패스
|
||||
$widget = $args->widget;
|
||||
$sequence = $args->widget_sequence;
|
||||
$cache = $args->widget_cache;
|
||||
if(!$sequence || !$cache) continue;
|
||||
|
||||
// 언어별로 위젯 캐시 파일이 있을 경우 재생성
|
||||
foreach($lang_list as $lang_type => $val) {
|
||||
$cache_file = sprintf('%s%d.%s.cache', $cache_path, $sequence, $lang_type);
|
||||
if(!file_exists($cache_file)) continue;
|
||||
|
||||
$oWidget->getCache($widget, $args, $lang_type, true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue