(bug 11353) Add ability to retrieve raw section content via 'action=raw' by specifyin...
authorDaniel Cannon <amidaniel@users.mediawiki.org>
Wed, 26 Sep 2007 05:23:03 +0000 (05:23 +0000)
committerDaniel Cannon <amidaniel@users.mediawiki.org>
Wed, 26 Sep 2007 05:23:03 +0000 (05:23 +0000)
RELEASE-NOTES
includes/RawPage.php

index 436fff1..aadfebf 100644 (file)
@@ -28,6 +28,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
   not set to 'mediawiki', allowing multiple mediawiki instances per user.
 * (bug 11151) Add descriptive <title> to revision history page
 * (bug 5412) Add feed links for the site to all pages
+* (bug 11353) Add ability to retrieve raw section content via action=raw
 
 === Bug fixes in 1.12 ===
 
index 9df94e5..defd74f 100644 (file)
@@ -15,7 +15,7 @@
  */
 class RawPage {
        var $mArticle, $mTitle, $mRequest;
-       var $mOldId, $mGen, $mCharset;
+       var $mOldId, $mGen, $mCharset, $mSection;
        var $mSmaxage, $mMaxage;
        var $mContentType, $mExpandTemplates;
 
@@ -38,7 +38,10 @@ class RawPage {
                $this->mExpandTemplates = $this->mRequest->getVal( 'templates' ) === 'expand';
                $this->mUseMessageCache = $this->mRequest->getBool( 'usemsgcache' );
 
+               $this->mSection = $this->mRequest->getIntOrNull( 'section' );
+
                $oldid = $this->mRequest->getInt( 'oldid' );
+
                switch ( $wgRequest->getText( 'direction' ) ) {
                        case 'next':
                                # output next revision, or nothing if there isn't one
@@ -177,7 +180,12 @@ class RawPage {
                                if ( $rev ) {
                                        $lastmod = wfTimestamp( TS_RFC2822, $rev->getTimestamp() );
                                        header( "Last-modified: $lastmod" );
-                                       $text = $rev->getText();
+
+                                       if ( !is_null($this->mSection) && $this->mSection != '' ) {
+                                               global $wgParser;
+                                               return $wgParser->getSection ( $rev->getText(), $this->mSection );
+                                       } else
+                                               $text = $rev->getText();
                                        $found = true;
                                }
                        }