if you save version N of InterWikiMap, it displays
version N-1.
I have caching NONE, and furthermore I instrumented
WikiDB_Page::save() to print "wikitext" (the actual
text of the page) and "type" (the
PageType_InterWikiMap-interpreted version, which turns
out to be N-1). You can see I've just saved without the
"foo bar50" line (not in "wikitext"), but it still
shows up in _map:
wikitext:
The InterWiki map used on this wiki is listed below.
The map is taken
from the text in the verbatim block below. (But this
only works if
this page is locked.)
<verbatim>
WikiPedia http://www.wikipedia.com/wiki
</verbatim>
type:
pagetype_interwikimap Object
(
[_map] => Array
(
[WikiPedia] => http://www.wikipedia.com/wiki
[foo] => bar50
[InterWLink] => http:/
[Upload] => http://gibson/../uploads/
)
[_regexp] => (?:WikiPedia|foo|InterWLink|Upload)
)
My guess is that it is rendering the map based on the
page cache, which is not updated until after the page
is saved.
Logged In: YES
user_id=417594
Patches I applied to make mine work properly:
diff -b -u -r1.4 -r1.5
--- CachedMarkup.php 16 Jun 2004 19:26:06 -0000 1.4
+++ CachedMarkup.php 20 Jul 2004 13:16:21 -0000 1.5
@@ -412,7 +412,7 @@
PageType_interwikimap::GetMap($GLOBALS['request']);
$label = isset($this->_label) ? $this->_label : false;
return $intermap->link($this->_link, $label);
}
=======================================
diff -b -u -r1.5 -r1.6
--- InlineParser.php 3 Jun 2004 18:23:48 -0000 1.5
+++ InlineParser.php 20 Jul 2004 13:16:35 -0000 1.6
@@ -286,7 +286,7 @@
global $request, $AllowedProtocols, $InlineImages;
$intermap = PageType_interwikimap::GetMap();
// $bracketlink will start and end with brackets; in
between will
// be either a page name, a URL or both separated by a
pipe.
@@ -423,13 +423,13 @@
{
function getMatchRegexp () {
global $request;
- $map = PageType_interwikimap::GetMap($request);
+ $map = PageType_interwikimap::GetMap();
return "(?<! [[:alnum:]])" . $map->getRegexp(). ":
\S+ (?<![ ,.?;! ] ) \" \' ])";
}
function markup ($match) {
global $request;
- $map = PageType_interwikimap::GetMap($request);
+ $map = PageType_interwikimap::GetMap();
return new Cached_InterwikiLink(UnWikiEscape($match));
}
}
==================================
diff -b -u -r1.3 -r1.4
--- PageType.php 19 Jul 2004 20:59:16 -0000 1.3
+++ PageType.php 20 Jul 2004 13:17:19 -0000 1.4
@@ -128,10 +128,21 @@
class PageType_interwikimap extends PageType
{
- function PageType_interwikimap() {
+ function PageType_interwikimap($pagetext = false) {
global $request;
$dbi = $request->getDbh();
- $intermap =
$this->getMapFromWikiPage($dbi->getPage(("InterWikiMap")));
+
+ if (!$pagetext) {
+ $page = $dbi->getPage(("InterWikiMap"));
+ if ($page->get('locked')) {
+ $current = $page->getCurrentRevision();
+ $pagetext = $current->getPackedContent();
+ }
+ else {
+ trigger_error(("WARNING: InterWikiMap page
is unlocked, so not using those links."));
+ }
+ }
+ $intermap = $this->_getMapFromWikiPageText($pagetext);
if (!$intermap && defined('INTERWIKI_MAP_FILE'))
$intermap =
$this->_getMapFromFile(INTERWIKI_MAP_FILE);
@@ -139,13 +150,8 @@
$this->_regexp = $this->_getRegexp();
}
return new PageType_interwikimap($pagetext);
}
function getRegexp() {
@@ -153,7 +159,6 @@
}
function link ($link, $linktext = false) {
@@ -201,14 +206,9 @@
return $map;
}
function _getMapFromWikiPage ($page) {
return false;
$current = $page->getCurrentRevision();
if (preg_match('|^<verbatim>\n(.*)^</verbatim>|ms',
return $m[1];
}
return false;
@@ -287,7 +287,7 @@
function format($text) {
return HTML::div(array('class' => 'wikitext'),
$this->_transform($this->_getHeader($text)),
- $this->_formatMap(),
+ $this->_formatMap($text),
$this->_transform($this->_getFooter($text)));
}
@@ -299,13 +299,13 @@
return preg_replace('@.*?(|\Z)@s', '',
$text, 1);
}
$map = PageType_interwikimap::getMap($pagetext);
return $map->_map;
}
function _formatMap() {
if (!$map)
return HTML::p("<no map="" found="">"); // Shouldn't
happen.</no>
=======================================
diff -b -u -r1.1 -r1.2
--- ExternalSearch.php 29 Jan 2004 14:30:28 -0000 1.1
+++ ExternalSearch.php 20 Jul 2004 13:17:54 -0000 1.2
@@ -20,7 +20,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA
*/
-require_once("lib/interwiki.php");
+//require_once("lib/interwiki.php");
/*
/
@@ -38,11 +38,11 @@
function _getInterWikiUrl(&$request) {
- $intermap = InterWikiMap::GetMap($request);
+ $intermap = PageType_interwikimap::GetMap();
$map = $intermap->_map;
@@ -118,8 +118,21 @@
};
===============================
diff -b -u -r1.1 -r1.2
--- stdlib.php 29 Jan 2004 14:30:27 -0000 1.1
+++ stdlib.php 20 Jul 2004 13:29:38 -0000 1.2
@@ -559,8 +558,8 @@
$bang_esc[] =
"(?:$AllowedProtocols):[^\s<>[]\"'()]*[^\s<>[]\"'(),.
?]";
$bang_esc[] = $map->getRegexp() . ":[^\s.,;?()]+";
// FIXME: is this r
eally needed?
$bang_esc[] = $WikiNameRegexp;