Merge "(bug 43207) Fix regression in API generator=duplicatefiles"
[lhc/web/wiklou.git] / includes / api / ApiQueryRevisions.php
index d159f2d..1d46b7a 100644 (file)
@@ -261,7 +261,7 @@ class ApiQueryRevisions extends ApiQueryBase {
                        // rvstart and rvstartid when that is supplied.
                        if ( !is_null( $params['continue'] ) ) {
                                $params['startid'] = $params['continue'];
-                               unset( $params['start'] );
+                               $params['start'] = null;
                        }
 
                        // This code makes an assumption that sorting by rev_id and rev_timestamp produces
@@ -439,12 +439,14 @@ class ApiQueryRevisions extends ApiQueryBase {
                        }
                }
 
-               if ( $this->fld_sha1 ) {
+               if ( $this->fld_sha1 && !$revision->isDeleted( Revision::DELETED_TEXT ) ) {
                        if ( $revision->getSha1() != '' ) {
                                $vals['sha1'] = wfBaseConvert( $revision->getSha1(), 36, 16, 40 );
                        } else {
                                $vals['sha1'] = '';
                        }
+               } elseif ( $this->fld_sha1 ) {
+                       $vals['sha1hidden'] = '';
                }
 
                if ( $this->fld_contentmodel ) {
@@ -546,9 +548,9 @@ class ApiQueryRevisions extends ApiQueryBase {
 
                        if ( $text === null ) {
                                $format = $this->contentFormat ? $this->contentFormat : $content->getDefaultFormat();
+                               $model = $content->getModel();
 
                                if ( !$content->isSupportedFormat( $format ) ) {
-                                       $model = $content->getModel();
                                        $name = $title->getPrefixedDBkey();
 
                                        $this->dieUsage( "The requested format {$this->contentFormat} is not supported ".
@@ -556,7 +558,11 @@ class ApiQueryRevisions extends ApiQueryBase {
                                }
 
                                $text = $content->serialize( $format );
+
+                               // always include format and model.
+                               // Format is needed to deserialize, model is needed to interpret.
                                $vals['contentformat'] = $format;
+                               $vals['contentmodel'] = $model;
                        }
 
                        if ( $text !== false ) {