summaryrefslogtreecommitdiff
path: root/includes/api/ApiQueryRevisionsBase.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2015-12-17 09:15:42 +0100
committerPierre Schmitz <pierre@archlinux.de>2015-12-17 09:44:51 +0100
commita1789ddde42033f1b05cc4929491214ee6e79383 (patch)
tree63615735c4ddffaaabf2428946bb26f90899f7bf /includes/api/ApiQueryRevisionsBase.php
parent9e06a62f265e3a2aaabecc598d4bc617e06fa32d (diff)
Update to MediaWiki 1.26.0
Diffstat (limited to 'includes/api/ApiQueryRevisionsBase.php')
-rw-r--r--includes/api/ApiQueryRevisionsBase.php38
1 files changed, 31 insertions, 7 deletions
diff --git a/includes/api/ApiQueryRevisionsBase.php b/includes/api/ApiQueryRevisionsBase.php
index 64f6120a..d57dc3cc 100644
--- a/includes/api/ApiQueryRevisionsBase.php
+++ b/includes/api/ApiQueryRevisionsBase.php
@@ -37,7 +37,7 @@ abstract class ApiQueryRevisionsBase extends ApiQueryGeneratorBase {
protected $fld_ids = false, $fld_flags = false, $fld_timestamp = false,
$fld_size = false, $fld_sha1 = false, $fld_comment = false,
$fld_parsedcomment = false, $fld_user = false, $fld_userid = false,
- $fld_content = false, $fld_tags = false, $fld_contentmodel = false;
+ $fld_content = false, $fld_tags = false, $fld_contentmodel = false, $fld_parsetree = false;
public function execute() {
$this->run();
@@ -104,6 +104,7 @@ abstract class ApiQueryRevisionsBase extends ApiQueryGeneratorBase {
$this->fld_userid = isset( $prop['userid'] );
$this->fld_user = isset( $prop['user'] );
$this->fld_tags = isset( $prop['tags'] );
+ $this->fld_parsetree = isset( $prop['parsetree'] );
if ( !empty( $params['contentformat'] ) ) {
$this->contentFormat = $params['contentformat'];
@@ -112,7 +113,7 @@ abstract class ApiQueryRevisionsBase extends ApiQueryGeneratorBase {
$this->limit = $params['limit'];
$this->fetchContent = $this->fld_content || !is_null( $this->diffto )
- || !is_null( $this->difftotext );
+ || !is_null( $this->difftotext ) || $this->fld_parsetree;
$smallLimit = false;
if ( $this->fetchContent ) {
@@ -273,10 +274,11 @@ abstract class ApiQueryRevisionsBase extends ApiQueryGeneratorBase {
$vals['textmissing'] = true;
}
}
- if ( $this->fld_content && $content ) {
- $text = null;
-
- if ( $this->generateXML ) {
+ if ( $this->fld_parsetree || ( $this->fld_content && $this->generateXML ) ) {
+ if ( !$this->fld_parsetree ) {
+ $this->logFeatureUsage( 'action=query&prop=revisions+base&generatexml' );
+ }
+ if ( $content ) {
if ( $content->getModel() === CONTENT_MODEL_WIKITEXT ) {
$t = $content->getNativeData(); # note: don't set $text
@@ -299,6 +301,10 @@ abstract class ApiQueryRevisionsBase extends ApiQueryGeneratorBase {
" uses content model " . $content->getModel() );
}
}
+ }
+
+ if ( $this->fld_content && $content ) {
+ $text = null;
if ( $this->expandTemplates && !$this->parseContent ) {
#XXX: implement template expansion for all content types in ContentHandler?
@@ -431,9 +437,26 @@ abstract class ApiQueryRevisionsBase extends ApiQueryGeneratorBase {
'comment',
'parsedcomment',
'content',
- 'tags'
+ 'tags',
+ 'parsetree',
),
ApiBase::PARAM_HELP_MSG => 'apihelp-query+revisions+base-param-prop',
+ ApiBase::PARAM_HELP_MSG_PER_VALUE => array(
+ 'ids' => 'apihelp-query+revisions+base-paramvalue-prop-ids',
+ 'flags' => 'apihelp-query+revisions+base-paramvalue-prop-flags',
+ 'timestamp' => 'apihelp-query+revisions+base-paramvalue-prop-timestamp',
+ 'user' => 'apihelp-query+revisions+base-paramvalue-prop-user',
+ 'userid' => 'apihelp-query+revisions+base-paramvalue-prop-userid',
+ 'size' => 'apihelp-query+revisions+base-paramvalue-prop-size',
+ 'sha1' => 'apihelp-query+revisions+base-paramvalue-prop-sha1',
+ 'contentmodel' => 'apihelp-query+revisions+base-paramvalue-prop-contentmodel',
+ 'comment' => 'apihelp-query+revisions+base-paramvalue-prop-comment',
+ 'parsedcomment' => 'apihelp-query+revisions+base-paramvalue-prop-parsedcomment',
+ 'content' => 'apihelp-query+revisions+base-paramvalue-prop-content',
+ 'tags' => 'apihelp-query+revisions+base-paramvalue-prop-tags',
+ 'parsetree' => array( 'apihelp-query+revisions+base-paramvalue-prop-parsetree',
+ CONTENT_MODEL_WIKITEXT ),
+ ),
),
'limit' => array(
ApiBase::PARAM_TYPE => 'limit',
@@ -448,6 +471,7 @@ abstract class ApiQueryRevisionsBase extends ApiQueryGeneratorBase {
),
'generatexml' => array(
ApiBase::PARAM_DFLT => false,
+ ApiBase::PARAM_DEPRECATED => true,
ApiBase::PARAM_HELP_MSG => 'apihelp-query+revisions+base-param-generatexml',
),
'parse' => array(