Index: trunk/phase3/includes/api/ApiParse.php |
— | — | @@ -49,7 +49,9 @@ |
50 | 50 | $prop = array_flip($params['prop']); |
51 | 51 | $revid = false; |
52 | 52 | |
53 | | - global $wgParser, $wgUser; |
| 53 | + // The parser needs $wgTitle to be set, apparently the |
| 54 | + // $title parameter in Parser::parse isn't enough *sigh* |
| 55 | + global $wgParser, $wgUser, $wgTitle; |
54 | 56 | $popts = new ParserOptions(); |
55 | 57 | $popts->setTidy(true); |
56 | 58 | $popts->enableLimitReport(); |
— | — | @@ -66,6 +68,7 @@ |
67 | 69 | $this->dieUsage("You don't have permission to view deleted revisions", 'permissiondenied'); |
68 | 70 | $text = $rev->getText( Revision::FOR_THIS_USER ); |
69 | 71 | $titleObj = $rev->getTitle(); |
| 72 | + $wgTitle = $titleObj; |
70 | 73 | $p_result = $wgParser->parse($text, $titleObj, $popts); |
71 | 74 | } |
72 | 75 | else |
— | — | @@ -111,6 +114,7 @@ |
112 | 115 | $titleObj = Title::newFromText($title); |
113 | 116 | if(!$titleObj) |
114 | 117 | $titleObj = Title::newFromText("API"); |
| 118 | + $wgTitle = $titleObj; |
115 | 119 | if($params['pst'] || $params['onlypst']) |
116 | 120 | $text = $wgParser->preSaveTransform($text, $titleObj, $wgUser, $popts); |
117 | 121 | if($params['onlypst']) |