Merge "Revert "SECURITY: Do not show log action if revdeleted" and fix UI message"
[lhc/web/wiklou.git] / includes / api / ApiQueryRevisionsBase.php
index 3879d7b..a658309 100644 (file)
@@ -32,7 +32,7 @@
 abstract class ApiQueryRevisionsBase extends ApiQueryGeneratorBase {
 
        protected $limit, $diffto, $difftotext, $expandTemplates, $generateXML, $section,
-               $parseContent, $contentFormat, $setParsedLimit = true;
+               $parseContent, $fetchContent, $contentFormat, $setParsedLimit = true;
 
        protected $fld_ids = false, $fld_flags = false, $fld_timestamp = false,
                $fld_size = false, $fld_sha1 = false, $fld_comment = false,
@@ -78,7 +78,7 @@ abstract class ApiQueryRevisionsBase extends ApiQueryGeneratorBase {
                        // DifferenceEngine returns a rather ambiguous empty
                        // string if that's not the case
                        if ( $params['diffto'] != 0 ) {
-                               $difftoRev = Revision::newFromID( $params['diffto'] );
+                               $difftoRev = Revision::newFromId( $params['diffto'] );
                                if ( !$difftoRev ) {
                                        $this->dieUsageMsg( array( 'nosuchrevid', $params['diffto'] ) );
                                }
@@ -111,8 +111,11 @@ abstract class ApiQueryRevisionsBase extends ApiQueryGeneratorBase {
 
                $this->limit = $params['limit'];
 
+               $this->fetchContent = $this->fld_content || !is_null( $this->diffto )
+                       || !is_null( $this->difftotext );
+
                $smallLimit = false;
-               if ( $this->fld_content || !is_null( $this->diffto ) || !is_null( $this->difftotext ) ) {
+               if ( $this->fetchContent ) {
                        $smallLimit = true;
                        $this->expandTemplates = $params['expandtemplates'];
                        $this->generateXML = $params['generatexml'];
@@ -249,7 +252,7 @@ abstract class ApiQueryRevisionsBase extends ApiQueryGeneratorBase {
 
                $content = null;
                global $wgParser;
-               if ( $this->fld_content || !is_null( $this->diffto ) || !is_null( $this->difftotext ) ) {
+               if ( $this->fetchContent ) {
                        $content = $revision->getContent( Revision::FOR_THIS_USER, $this->getUser() );
                        // Expand templates after getting section content because
                        // template-added sections don't count and Parser::preprocess()