}
if ( !is_null( $params['difftotext'] ) ) {
- $this->difftotext = $params['difftotext'];
+ $this->difftotext = $params['difftotext']; #FIXME: handle non-text content!
} elseif ( !is_null( $params['diffto'] ) ) {
if ( $params['diffto'] == 'cur' ) {
$params['diffto'] = 0;
}
}
+ // add user name, if needed
+ if ( $this->fld_user ) {
+ $this->addTables( 'user' );
+ $this->addJoinConds( array( 'user' => Revision::userJoinCond() ) );
+ $this->addFields( Revision::selectUserFields() );
+ }
+
// Bug 24166 - API error when using rvprop=tags
$this->addTables( 'revision' );
$this->addWhereFld( 'rev_id', array_keys( $revs ) );
if ( !is_null( $params['continue'] ) ) {
- $this->addWhere( "rev_id >= '" . intval( $params['continue'] ) . "'" );
+ $this->addWhere( 'rev_id >= ' . intval( $params['continue'] ) );
}
$this->addOption( 'ORDER BY', 'rev_id' );
$pageid = intval( $cont[0] );
$revid = intval( $cont[1] );
$this->addWhere(
- "rev_page > '$pageid' OR " .
- "(rev_page = '$pageid' AND " .
- "rev_id >= '$revid')"
+ "rev_page > $pageid OR " .
+ "(rev_page = $pageid AND " .
+ "rev_id >= $revid)"
);
}
$this->addOption( 'ORDER BY', array(
$vals['diff'] = array();
$context = new DerivativeContext( $this->getContext() );
$context->setTitle( $title );
+ $handler = ContentHandler::getForTitle( $title );
+
if ( !is_null( $this->difftotext ) ) {
- $engine = new DifferenceEngine( $context );
- $engine->setText( $text, $this->difftotext );
+ $engine = $handler->createDifferenceEngine( $context );
+ $engine->setText( $text, $this->difftotext ); #FIXME: use content objects!...
} else {
- $engine = new DifferenceEngine( $context, $revision->getID(), $this->diffto );
+ $engine = $handler->createDifferenceEngine( $context, $revision->getID(), $this->diffto );
$vals['diff']['from'] = $engine->getOldid();
$vals['diff']['to'] = $engine->getNewid();
}