• R/O
  • HTTP
  • SSH
  • HTTPS

提交

標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

修訂2a89cdb3824c68dcae9f4254497382bacd3493e9 (tree)
時間2017-10-24 02:28:38
作者umorigu <umorigu@gmai...>
Commiterumorigu

Log Message

BugTrack/2446 Fasten calendar_viewer plugin with get_existpage cache

Change Summary

差異

--- a/plugin/calendar_viewer.inc.php
+++ b/plugin/calendar_viewer.inc.php
@@ -110,52 +110,34 @@ function plugin_calendar_viewer_convert()
110110 $s_page = htmlsc($pagename);
111111 return "#calendar_viewer(): Exceeded the limit of show count: $s_page<br />";
112112 }
113-
114- // 一覧表示するページ名とファイル名のパターン ファイル名には年月を含む
115- if ($pagename == '') {
116- // pagename無しのyyyy-mm-ddに対応するための処理
117- $pagepattern = '';
118- $pagepattern_len = 0;
119- $filepattern = encode($page_YM);
120- $filepattern_len = strlen($filepattern);
121- } else {
122- $pagepattern = strip_bracket($pagename) . '/';
123- $pagepattern_len = strlen($pagepattern);
124- $filepattern = encode($pagepattern . $page_YM);
125- $filepattern_len = strlen($filepattern);
113+ // page name pattern
114+ $pagepattern = strip_bracket($pagename) . '/';
115+ if ($pagename === '') {
116+ // Support non-pagename yyyy-mm-dd pattern
117+ $pagepattern = '';
126118 }
127-
128- // ページリストの取得
119+ $pagepattern_len = strlen($pagepattern);
120+ // Get pagelist
129121 $pagelist = array();
130- if ($dir = @opendir(DATA_DIR)) {
131- $_date = get_date('Y' . $date_sep . 'm' . $date_sep . 'd');
132- $page_date = '';
133- while($file = readdir($dir)) {
134- if ($file == '..' || $file == '.') continue;
135- if (substr($file, 0, $filepattern_len) != $filepattern) continue;
136-
137- $page = decode(trim(preg_replace('/\.txt$/', ' ', $file)));
138- $page_date = substr($page, $pagepattern_len);
139-
140- // Verify the $page_date pattern (Default: yyyy-mm-dd).
141- // Past-mode hates the future, and
142- // Future-mode hates the past.
143- if ((plugin_calendar_viewer_isValidDate($page_date, $date_sep) == FALSE) ||
144- ($page_date > $_date && ($mode == 'past')) ||
145- ($page_date < $_date && ($mode == 'future')))
146- continue;
147-
148- $pagelist[] = $page;
122+ $_date = get_date('Y' . $date_sep . 'm' . $date_sep . 'd');
123+ foreach (get_existpages() as $page) {
124+ if (strncmp($page, $pagepattern, $pagepattern_len) !== 0) continue;
125+ $page_date = substr($page, $pagepattern_len);
126+ // Verify the $page_date pattern (Default: yyyy-mm-dd).
127+ // Past-mode hates the future, and
128+ // Future-mode hates the past.
129+ if ((plugin_calendar_viewer_isValidDate($page_date, $date_sep) === FALSE) ||
130+ ($page_date > $_date && ($mode === 'past')) ||
131+ ($page_date < $_date && ($mode === 'future'))) {
132+ continue;
149133 }
134+ $pagelist[] = $page;
150135 }
151- closedir($dir);
152-
153136 if ($mode == 'past') {
154137 rsort($pagelist, SORT_STRING); // New => Old
155138 } else {
156139 sort($pagelist, SORT_STRING); // Old => New
157140 }
158-
159141 // Include start
160142 $tmppage = $vars['page'];
161143 $return_body = '';