Merge "Add 'contentmodel' to resultproperties in prop=revisions"
authorIAlex <ialex.wiki@gmail.com>
Thu, 15 Nov 2012 10:10:00 +0000 (10:10 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Thu, 15 Nov 2012 10:10:00 +0000 (10:10 +0000)
1  2 
includes/api/ApiQueryRevisions.php

@@@ -261,7 -261,7 +261,7 @@@ class ApiQueryRevisions extends ApiQuer
                        // 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
  
                        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 ".
                                }
  
                                $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 ) {
                                        ApiBase::PROP_NULLABLE => true
                                ),
                                'texthidden' => 'boolean'
-                       )
+                       ),
+                       'contentmodel' => array(
+                               'contentmodel' => 'string'
+                       ),
                );
  
                self::addTokenProperties( $props, $this->getTokenFunctions() );