$this->addWhere( 'ar_deleted = 0' );
$this->addFields( array( 'ar_title', 'ar_namespace', 'ar_timestamp' ) );
- if ( $fld_parentid ) {
- $this->addFields( 'ar_parent_id' );
- }
- if ( $fld_revid ) {
- $this->addFields( 'ar_rev_id' );
- }
- if ( $fld_user ) {
- $this->addFields( 'ar_user_text' );
- }
- if ( $fld_userid ) {
- $this->addFields( 'ar_user' );
- }
- if ( $fld_comment || $fld_parsedcomment ) {
- $this->addFields( 'ar_comment' );
- }
- if ( $fld_minor ) {
- $this->addFields( 'ar_minor_edit' );
- }
- if ( $fld_len ) {
- $this->addFields( 'ar_len' );
- }
+ $this->addFieldsIf( 'ar_parent_id', $fld_parentid );
+ $this->addFieldsIf( 'ar_rev_id', $fld_revid );
+ $this->addFieldsIf( 'ar_user_text', $fld_user );
+ $this->addFieldsIf( 'ar_user', $fld_userid );
+ $this->addFieldsIf( 'ar_comment', $fld_comment || $fld_parsedcomment );
+ $this->addFieldsIf( 'ar_minor_edit', $fld_minor );
+ $this->addFieldsIf( 'ar_len', $fld_len );
+
if ( $fld_content ) {
$this->addTables( 'text' );
$this->addFields( array( 'ar_text', 'ar_text_id', 'old_text', 'old_flags' ) );
$this->addWhereRange( 'ar_namespace', $dir, null, null );
$this->addWhereRange( 'ar_title', $dir, null, null );
}
- $this->addWhereRange( 'ar_timestamp', $dir, $params['start'], $params['end'] );
+ $this->addTimestampWhereRange( 'ar_timestamp', $dir, $params['start'], $params['end'] );
}
$res = $this->select( __METHOD__ );
$pageMap = array(); // Maps ns&title to (fake) pageid
if ( $fld_revid ) {
$rev['revid'] = intval( $row->ar_rev_id );
}
- if ( $fld_parentid ) {
+ if ( $fld_parentid && !is_null( $row->ar_parent_id ) ) {
$rev['parentid'] = intval( $row->ar_parent_id );
}
if ( $fld_user ) {
$title = Title::makeTitle( $row->ar_namespace, $row->ar_title );
if ( $fld_parsedcomment ) {
- $rev['parsedcomment'] = $wgUser->getSkin()->formatComment( $row->ar_comment, $title );
+ $rev['parsedcomment'] = Linker::formatComment( $row->ar_comment, $title );
}
if ( $fld_minor && $row->ar_minor_edit == 1 ) {
$rev['minor'] = '';
$p = $this->getModulePrefix();
return array(
'List deleted revisions.',
- 'This module operates in three modes:',
+ 'Operates in three modes:',
' 1) List deleted revisions for the given title(s), sorted by timestamp',
' 2) List deleted contributions for the given user, sorted by timestamp (no titles specified)',
" 3) List all deleted revisions in the given namespace, sorted by title and timestamp (no titles specified, {$p}user not set)",
) );
}
- protected function getExamples() {
+ public function getExamples() {
return array(
'List the last deleted revisions of Main Page and Talk:Main Page, with content (mode 1):',
' api.php?action=query&list=deletedrevs&titles=Main%20Page|Talk:Main%20Page&drprop=user|comment|content',
);
}
+ public function getHelpUrls() {
+ return 'http://www.mediawiki.org/wiki/API:Deletedrevs';
+ }
+
public function getVersion() {
return __CLASS__ . ': $Id$';
}