// 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'] ) );
}
if ( $this->limit == 'max' ) {
$this->limit = $this->getMain()->canApiHighLimits() ? $botMax : $userMax;
if ( $this->setParsedLimit ) {
- $this->getResult()->setParsedLimit( $this->getModuleName(), $this->limit );
+ $this->getResult()->addParsedLimit( $this->getModuleName(), $this->limit );
}
}
}
}
- if ( $this->fld_flags && $revision->isMinor() ) {
- $vals['minor'] = '';
+ if ( $this->fld_flags ) {
+ $vals['minor'] = $revision->isMinor();
}
if ( $this->fld_user || $this->fld_userid ) {
if ( $revision->isDeleted( Revision::DELETED_USER ) ) {
- $vals['userhidden'] = '';
+ $vals['userhidden'] = true;
$anyHidden = true;
}
if ( $revision->userCan( Revision::DELETED_USER, $user ) ) {
if ( $this->fld_user ) {
- $vals['user'] = $revision->getRawUserText();
+ $vals['user'] = $revision->getUserText( Revision::RAW );
}
- $userid = $revision->getRawUser();
+ $userid = $revision->getUser( Revision::RAW );
if ( !$userid ) {
- $vals['anon'] = '';
+ $vals['anon'] = true;
}
if ( $this->fld_userid ) {
if ( $this->fld_sha1 ) {
if ( $revision->isDeleted( Revision::DELETED_TEXT ) ) {
- $vals['sha1hidden'] = '';
+ $vals['sha1hidden'] = true;
$anyHidden = true;
}
if ( $revision->userCan( Revision::DELETED_TEXT, $user ) ) {
if ( $this->fld_comment || $this->fld_parsedcomment ) {
if ( $revision->isDeleted( Revision::DELETED_COMMENT ) ) {
- $vals['commenthidden'] = '';
+ $vals['commenthidden'] = true;
$anyHidden = true;
}
if ( $revision->userCan( Revision::DELETED_COMMENT, $user ) ) {
- $comment = $revision->getRawComment();
+ $comment = $revision->getComment( Revision::RAW );
if ( $this->fld_comment ) {
$vals['comment'] = $comment;
if ( $this->fld_tags ) {
if ( $row->ts_tags ) {
$tags = explode( ',', $row->ts_tags );
- $this->getResult()->setIndexedTagName( $tags, 'tag' );
+ ApiResult::setIndexedTagName( $tags, 'tag' );
$vals['tags'] = $tags;
} else {
$vals['tags'] = array();
}
}
if ( $revision->isDeleted( Revision::DELETED_TEXT ) ) {
- $vals['texthidden'] = '';
+ $vals['texthidden'] = true;
$anyHidden = true;
} elseif ( !$content ) {
- $vals['textmissing'] = '';
+ $vals['textmissing'] = true;
}
}
if ( $this->fld_content && $content ) {
}
$vals['parsetree'] = $xml;
} else {
- $vals['badcontentformatforparsetree'] = '';
+ $vals['badcontentformatforparsetree'] = true;
$this->setWarning( "Conversion to XML is supported for wikitext only, " .
$title->getPrefixedDBkey() .
" uses content model " . $content->getModel() );
$this->setWarning( "Template expansion is supported for wikitext only, " .
$title->getPrefixedDBkey() .
" uses content model " . $content->getModel() );
- $vals['badcontentformat'] = '';
+ $vals['badcontentformat'] = true;
$text = false;
}
}
$name = $title->getPrefixedDBkey();
$this->setWarning( "The requested format {$this->contentFormat} is not " .
"supported for content model $model used by $name" );
- $vals['badcontentformat'] = '';
+ $vals['badcontentformat'] = true;
$text = false;
} else {
$text = $content->serialize( $format );
}
if ( $text !== false ) {
- ApiResult::setContent( $vals, $text );
+ ApiResult::setContentValue( $vals, 'content', $text );
}
}
$name = $title->getPrefixedDBkey();
$this->setWarning( "The requested format {$this->contentFormat} is not " .
"supported for content model $model used by $name" );
- $vals['diff']['badcontentformat'] = '';
+ $vals['diff']['badcontentformat'] = true;
$engine = null;
} else {
$difftocontent = ContentHandler::makeContent(
}
if ( $engine ) {
$difftext = $engine->getDiffBody();
- ApiResult::setContent( $vals['diff'], $difftext );
+ ApiResult::setContentValue( $vals['diff'], 'body', $difftext );
if ( !$engine->wasCacheHit() ) {
$n++;
}
}
} else {
- $vals['diff']['notcached'] = '';
+ $vals['diff']['notcached'] = true;
}
}
if ( $anyHidden && $revision->isDeleted( Revision::DELETED_RESTRICTED ) ) {
- $vals['suppressed'] = '';
+ $vals['suppressed'] = true;
}
return $vals;