Skip to content

Instantly share code, notes, and snippets.

@catrope
Created September 28, 2011 12:29
Show Gist options
  • Save catrope/1247811 to your computer and use it in GitHub Desktop.
Save catrope/1247811 to your computer and use it in GitHub Desktop.
Proposed hack for iOS API issue
Index: includes/parser/ParserCache.php
===================================================================
--- includes/parser/ParserCache.php (revision 98303)
+++ includes/parser/ParserCache.php (working copy)
@@ -50,7 +50,7 @@
// idhash seem to mean 'page id' + 'rendering hash' (r3710)
$pageid = $article->getID();
- $renderkey = (int)($wgRequest->getVal('action') == 'render');
+ $renderkey = (int)($wgRequest->getVal('action') == 'render') + 2*(int)($wgRequest->getVal('action') == 'parse');
$key = wfMemcKey( 'pcache', 'idhash', "{$pageid}-{$renderkey}!{$hash}" );
return $key;
Index: includes/Title.php
===================================================================
--- includes/Title.php (revision 98303)
+++ includes/Title.php (working copy)
@@ -951,6 +951,12 @@
if ( $wgRequest->getVal( 'action' ) == 'render' ) {
$url = $wgServer . $url;
}
+
+ // HACK for iOS issue: expand URLs to absolute in API action=parse
+ // See http://lists.wikimedia.org/pipermail/mediawiki-api/2011-September/002361.html for details
+ if ( $wgRequest->getVal( 'action' ) == 'parse' ) {
+ $url = wfExpandUrl( $url, PROTO_CANONICAL );
+ }
}
wfRunHooks( 'GetLocalURL', array( &$this, &$url, $query, $variant ) );
return $url;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment