• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

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

Commit MetaInfo

Revisão5b4382f0d3b67a4cddf582ac78a1de284e3d9b50 (tree)
Hora2007-09-22 20:04:47
Autorhenoheno <henoheno>
Commiterhenoheno

Mensagem de Log

Tracker_list: Rough but works: Don't load unused fields

Mudança Sumário

Diff

--- a/plugin/tracker.inc.php
+++ b/plugin/tracker.inc.php
@@ -1,6 +1,6 @@
11 <?php
22 // PukiWiki - Yet another WikiWikiWeb clone
3-// $Id: tracker.inc.php,v 1.63 2007/09/22 08:24:41 henoheno Exp $
3+// $Id: tracker.inc.php,v 1.64 2007/09/22 11:04:47 henoheno Exp $
44 // Copyright (C) 2003-2005, 2007 PukiWiki Developers Team
55 // License: GPL v2 or (at your option) any later version
66 //
@@ -769,30 +769,39 @@ class Tracker_list
769769
770770 $fieldname = array_shift($source);
771771 if (isset($fields[$fieldname])) {
772- $pattern[] = '(.*)'; // Just capture it
772+ $pattern[] = '(.*?)'; // Just capture it
773773 $pattern_fields[] = $fieldname; // Capture it as this $filedname
774774 } else {
775- $pattern[] = '.*'; // Just ignore pseudo fields etc
775+ $pattern[] = '.*?'; // Just ignore pseudo fields etc
776776 }
777777 }
778- $this->pattern = '/' . implode('', $pattern) . '/s';
778+ $this->pattern = '/' . implode('', $pattern) . '/sS';
779779 $this->pattern_fields = $pattern_fields;
780780 }
781781
782782 // Load pages
783783 function _load()
784784 {
785- $base = $this->base;
786-
787- $pattern = $base . '/';
785+ $pattern = $this->base . '/';
788786 $pattern_len = strlen($pattern);
787+
789788 foreach (get_existpages() as $_page) {
790789 if (strpos($_page, $pattern) === 0) {
791790 $name = substr($_page, $pattern_len);
792791 if (preg_match(PLUGIN_TRACKER_LIST_EXCLUDE_PATTERN, $name)) continue;
793- $this->add($_page, $name);
792+
793+ // Adding $this->rows
794+ if ($this->add($_page, $name) === FALSE) {
795+ return FALSE;
796+ }
794797 }
795798 }
799+ if (empty($this->rows)) {
800+ $this->error = 'Pages not found under: ' . $pattern;
801+ return FALSE;
802+ }
803+
804+ return TRUE;
796805 }
797806
798807 function add($page, $name)
@@ -808,10 +817,10 @@ class Tracker_list
808817 $to_page = strip_bracket(trim($matches[1]));
809818 if (is_page($to_page)) {
810819 unset($source); // Release
811- $this->add($to_page, $name); // Recurse(Rescan)
812- return;
820+ return $this->add($to_page, $name); // Recurse(Rescan)
813821 } else {
814- return; // Invalid
822+ $this->error = 'add(): Invalid pagename';
823+ return FALSE;
815824 }
816825 }
817826
@@ -839,6 +848,7 @@ class Tracker_list
839848 }
840849
841850 $this->rows[$name] = $row;
851+ return TRUE;
842852 }
843853
844854 // sort()
@@ -1115,14 +1125,10 @@ class Tracker_list
11151125 $this->_generate_regex();
11161126
11171127 // Load $this->rows
1118- $this->_load();
1119- if (empty($this->rows)) {
1120- $this->error = 'Pages not found under: ' . $this->base . '/';
1121- return FALSE;
1122- }
1128+ if ($this->_load() === FALSE) return FALSE;
11231129
11241130 // Sort $this->rows
1125- $this->_sort();
1131+ if ($this->_sort() === FALSE) return FALSE;
11261132 $rows = $this->rows;
11271133
11281134 $count = count($this->rows);