(bug 14471) Use HTMLTidy and generate limit report in action=parse
authorRoan Kattouw <catrope@users.mediawiki.org>
Thu, 12 Jun 2008 11:50:01 +0000 (11:50 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Thu, 12 Jun 2008 11:50:01 +0000 (11:50 +0000)
RELEASE-NOTES
includes/api/ApiParse.php

index e103b1a..96e595d 100644 (file)
@@ -438,6 +438,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * Added md5 parameter to action=edit
 * (bug 14335) Logging in to unified account using API not possible
 * Added action=emailuser to send an email to a user
+* (bug 14471) Use HTMLTidy and generate limit report in action=parse
 
 === Languages updated in 1.13 ===
 
index 62f0437..fe195c4 100644 (file)
@@ -50,6 +50,9 @@ class ApiParse extends ApiBase {
                $revid = false;
 
                global $wgParser, $wgUser;
+               $popts = new ParserOptions();
+               $popts->setTidy(true);
+               $popts->enableLimitReport();
                if(!is_null($oldid) || !is_null($page))
                {
                        if(!is_null($oldid))
@@ -62,7 +65,7 @@ class ApiParse extends ApiBase {
                                        $this->dieUsage("You don't have permission to view deleted revisions", 'permissiondenied');
                                $text = $rev->getRawText();
                                $titleObj = $rev->getTitle();
-                               $p_result = $wgParser->parse($text, $titleObj, new ParserOptions());
+                               $p_result = $wgParser->parse($text, $titleObj, $popts);
                        }
                        else
                        {
@@ -77,7 +80,7 @@ class ApiParse extends ApiBase {
                                $pcache = ParserCache::singleton();
                                $p_result = $pcache->get($articleObj, $wgUser);
                                if(!$p_result) {
-                                       $p_result = $wgParser->parse($articleObj->getContent(), $titleObj, new ParserOptions());
+                                       $p_result = $wgParser->parse($articleObj->getContent(), $titleObj, $popts);
                                        global $wgUseParserCache;
                                        if($wgUseParserCache)
                                                $pcache->save($p_result, $articleObj, $wgUser);
@@ -89,7 +92,7 @@ class ApiParse extends ApiBase {
                        $titleObj = Title::newFromText($title);
                        if(!$titleObj)
                                $titleObj = Title::newFromText("API");
-                       $p_result = $wgParser->parse($text, $titleObj, new ParserOptions());
+                       $p_result = $wgParser->parse($text, $titleObj, $popts);
                }
 
                // Return result