* @file
*/
+use MediaWiki\MediaWikiServices;
+
/**
* Allows user to patrol pages
* @ingroup API
$this->dieWithError( [ 'apierror-nosuchrcid', $params['rcid'] ] );
}
} else {
- $rev = Revision::newFromId( $params['revid'] );
+ $store = MediaWikiServices::getInstance()->getRevisionStore();
+ $rev = $store->getRevisionById( $params['revid'] );
if ( !$rev ) {
$this->dieWithError( [ 'apierror-nosuchrevid', $params['revid'] ] );
}
- $rc = $rev->getRecentChange();
+ $rc = $store->getRecentChange( $rev );
if ( !$rc ) {
$this->dieWithError( [ 'apierror-notpatrollable', $params['revid'] ] );
}
$this->dieStatus( $this->errorArrayToStatus( $retval, $user ) );
}
- $result = [ 'rcid' => intval( $rc->getAttribute( 'rc_id' ) ) ];
+ $result = [ 'rcid' => (int)$rc->getAttribute( 'rc_id' ) ];
ApiQueryBase::addTitleInfo( $result, $rc->getTitle() );
$this->getResult()->addValue( null, $this->getModuleName(), $result );
}