Revisão | d5bb0080b40245f642cd5d0353a4d826a70bbdac (tree) |
---|---|
Hora | 2018-03-01 23:40:07 |
Autor | umorigu <umorigu@gmai...> |
Commiter | umorigu |
BugTrack/560 tracker_list cache mechanism supports limit parameter
@@ -221,36 +221,6 @@ function plugin_tracker_get_page_list($page, $needs_filetime) { | ||
221 | 221 | return $page_list; |
222 | 222 | } |
223 | 223 | |
224 | - | |
225 | -/* | |
226 | -function plugin_tracker_inline() | |
227 | -{ | |
228 | - global $vars; | |
229 | - | |
230 | - if (PKWK_READONLY) return ''; // Show nothing | |
231 | - | |
232 | - $args = func_get_args(); | |
233 | - if (count($args) < 3) | |
234 | - { | |
235 | - return FALSE; | |
236 | - } | |
237 | - $body = array_pop($args); | |
238 | - list($config_name,$field) = $args; | |
239 | - | |
240 | - $config = new Config('plugin/tracker/'.$config_name); | |
241 | - | |
242 | - if (!$config->read()) | |
243 | - { | |
244 | - return "config file '".htmlsc($config_name)."' not found."; | |
245 | - } | |
246 | - | |
247 | - $config->config_name = $config_name; | |
248 | - | |
249 | - $fields = plugin_tracker_get_fields($vars['page'],$vars['page'],$config); | |
250 | - $fields[$field]->default_value = $body; | |
251 | - return $fields[$field]->get_tag(); | |
252 | -} | |
253 | -*/ | |
254 | 224 | // フィールドオブジェクトを構築する |
255 | 225 | function plugin_tracker_get_fields($base,$refer,&$config) |
256 | 226 | { |
@@ -703,7 +673,13 @@ function plugin_tracker_getlist($page,$refer,$config_name,$list,$order='',$limit | ||
703 | 673 | |
704 | 674 | $cache_enabled = defined('TRACKER_LIST_USE_CACHE') && TRACKER_LIST_USE_CACHE && |
705 | 675 | defined('JSON_UNESCAPED_UNICODE') && defined('PKWK_UTF8_ENABLE'); |
706 | - $cache_filepath = CACHE_DIR . encode($page) . '.tracker'; | |
676 | + if (is_null($limit)) { | |
677 | + $cache_filepath = CACHE_DIR . encode($page) . '.tracker'; | |
678 | + } else if (pkwk_ctype_digit($limit) && 0 < $limit && $limit <= 1000) { | |
679 | + $cache_filepath = CACHE_DIR . encode($page) . '.' . $limit . '.tracker'; | |
680 | + } else { | |
681 | + $cache_enabled = false; | |
682 | + } | |
707 | 683 | $cachedata = null; |
708 | 684 | $cache_format_version = 1; |
709 | 685 | if ($cache_enabled) { |