* (bug 22297) safesubst: to allow substitution without breaking transclusion
* (bug 18758) API read of watchlist's wl_notificationtimestamp
* (bug 20809) Expose EditFormPreloadText via the API
+* (bug 18427) Comment (edit summary) parser option for API
=== Languages updated in 1.16 ===
$fld_revid = isset( $prop['revid'] );
$fld_user = isset( $prop['user'] );
$fld_comment = isset( $prop['comment'] );
+ $fld_parsedcomment = isset ( $prop['parsedcomment'] );
$fld_minor = isset( $prop['minor'] );
$fld_len = isset( $prop['len'] );
$fld_content = isset( $prop['content'] );
$this->addFields( 'ar_rev_id' );
if ( $fld_user )
$this->addFields( 'ar_user_text' );
- if ( $fld_comment )
+ if ( $fld_comment || $fld_parsedcomment )
$this->addFields( 'ar_comment' );
if ( $fld_minor )
$this->addFields( 'ar_minor_edit' );
$rev['user'] = $row->ar_user_text;
if ( $fld_comment )
$rev['comment'] = $row->ar_comment;
+
+ $title = Title::makeTitle( $row->ar_namespace, $row->ar_title );
+
+ if ( $fld_parsedcomment) {
+ global $wgUser;
+ $rev['parsedcomment'] = $wgUser->getSkin()->formatComment( $row->ar_comment, $title );
+ }
if ( $fld_minor && $row->ar_minor_edit == 1 )
- $rev['minor'] = '';
+ $rev['minor'] = '';
if ( $fld_len )
$rev['len'] = $row->ar_len;
if ( $fld_content )
if ( !isset( $pageMap[$row->ar_namespace][$row->ar_title] ) ) {
$pageID = $newPageID++;
$pageMap[$row->ar_namespace][$row->ar_title] = $pageID;
- $t = Title::makeTitle( $row->ar_namespace, $row->ar_title );
$a['revisions'] = array( $rev );
$result->setIndexedTagName( $a['revisions'], 'rev' );
- ApiQueryBase::addTitleInfo( $a, $t );
+ ApiQueryBase::addTitleInfo( $a, $title );
if ( $fld_token )
$a['token'] = $token;
$fit = $result->addValue( array( 'query', $this->getModuleName() ), $pageID, $a );
'revid',
'user',
'comment',
+ 'parsedcomment',
'minor',
'len',
'content',
$this->fld_user = isset( $prop['user' );
$this->fld_timestamp = isset( $prop['timestamp' );
$this->fld_comment = isset( $prop['comment' );
+ $this->fld_parsedcomment = isset ( $prop['parsedcomment'] );
$this->fld_details = isset( $prop['details' );
$this->fld_tags = isset( $prop['tags' );
$this->addFieldsIf( 'user_name', $this->fld_user );
$this->addFieldsIf( 'log_namespace', $this->fld_title );
$this->addFieldsIf( 'log_title', $this->fld_title );
- $this->addFieldsIf( 'log_comment', $this->fld_comment );
+ $this->addFieldsIf( 'log_comment', $this->fld_comment || $this->fld_parsedcomment );
$this->addFieldsIf( 'log_params', $this->fld_details );
if ( $this->fld_tags ) {
$vals['pageid'] = intval( $row->page_id );
}
+ $title = Title :: makeTitle( $row->log_namespace, $row->log_title );
+
if ( $this->fld_title ) {
if ( LogEventsList::isDeleted( $row, LogPage::DELETED_ACTION ) ) {
$vals['actionhidden'] = '';
} else {
- $title = Title :: makeTitle( $row->log_namespace, $row->log_title );
ApiQueryBase :: addTitleInfo( $vals, $title );
}
}
if ( $this->fld_timestamp ) {
$vals['timestamp'] = wfTimestamp( TS_ISO_8601, $row->log_timestamp );
}
- if ( $this->fld_comment && isset( $row->log_comment ) ) {
+
+ if ( ($this->fld_comment || $this->fld_parsedcomment) && isset( $row->log_comment ) ) {
if ( LogEventsList::isDeleted( $row, LogPage::DELETED_COMMENT ) ) {
$vals['commenthidden'] = '';
} else {
- $vals['comment'] = $row->log_comment;
+ if ( $this->fld_comment )
+ $vals['comment'] = $row->log_comment;
+
+ if ( $this->fld_parsedcomment ) {
+ global $wgUser;
+ $vals['parsedcomment'] = $wgUser->getSkin()->formatComment( $row->log_comment, $title );
+ }
}
}
'user',
'timestamp',
'comment',
+ 'parsedcomment',
'details',
'tags'
)
$prop = array_flip( $params['prop'] );
$this->addFieldsIf( 'pt_user', isset( $prop['user'] ) );
- $this->addFieldsIf( 'pt_reason', isset( $prop['comment'] ) );
+ $this->addFieldsIf( 'pt_reason', isset( $prop['comment'] ) || isset( $prop['parsedcomment'] ) );
$this->addFieldsIf( 'pt_expiry', isset( $prop['expiry'] ) );
$this->addFieldsIf( 'pt_create_perm', isset( $prop['level'] ) );
if ( isset( $prop['comment'] ) )
$vals['comment'] = $row->pt_reason;
+ if ( isset( $prop['parsedcomment'] ) ) {
+ global $wgUser;
+ $vals['parsedcomment'] = $wgUser->getSkin()->formatComment( $row->pt_reason, $title );
+ }
+
if ( isset( $prop['expiry'] ) )
$vals['expiry'] = Block::decodeExpiry( $row->pt_expiry, TS_ISO_8601 );
$vals['level'] = $row->pt_create_perm;
$fit = $result->addValue( array( 'query', $this->getModuleName() ), null, $vals );
- if ( !$fit )
- {
+ if ( !$fit ) {
$this->setContinueEnumParameter( 'start',
wfTimestamp( TS_ISO_8601, $row->pt_timestamp ) );
break;
'timestamp',
'user',
'comment',
+ 'parsedcomment',
'expiry',
'level'
)
parent :: __construct( $query, $moduleName, 'rc' );
}
- private $fld_comment = false, $fld_user = false, $fld_flags = false,
+ private $fld_comment = false, $fld_parsedcomment = false, $fld_user = false, $fld_flags = false,
$fld_timestamp = false, $fld_title = false, $fld_ids = false,
$fld_sizes = false;
/**
*/
public function initProperties( $prop ) {
$this->fld_comment = isset ( $prop['comment'] );
+ $this->fld_parsedcomment = isset ( $prop['parsedcomment'] );
$this->fld_user = isset ( $prop['user'] );
$this->fld_flags = isset ( $prop['flags'] );
$this->fld_timestamp = isset ( $prop['timestamp'] );
$this->addFieldsIf( 'rc_id', $this->fld_ids );
$this->addFieldsIf( 'rc_this_oldid', $this->fld_ids );
$this->addFieldsIf( 'rc_last_oldid', $this->fld_ids );
- $this->addFieldsIf( 'rc_comment', $this->fld_comment );
+ $this->addFieldsIf( 'rc_comment', $this->fld_comment || $this->fld_parsedcomment );
$this->addFieldsIf( 'rc_user', $this->fld_user );
$this->addFieldsIf( 'rc_user_text', $this->fld_user );
$this->addFieldsIf( 'rc_minor', $this->fld_flags );
/* Add edit summary / log summary. */
if ( $this->fld_comment && isset( $row->rc_comment ) ) {
$vals['comment'] = $row->rc_comment;
+
+ if ( $this->fld_parsedcomment && isset( $row->rc_comment ) ) {
+ global $wgUser;
+ $vals['parsedcomment'] = $wgUser->getSkin()->formatComment( $row->rc_comment, $title );
}
if ( $this->fld_redirect )
ApiBase :: PARAM_TYPE => array (
'user',
'comment',
+ 'parsedcomment',
'flags',
'timestamp',
'title',
private $params, $username;
private $fld_ids = false, $fld_title = false, $fld_timestamp = false,
- $fld_comment = false, $fld_flags = false,
+ $fld_comment = false, $fld_parsedcomment = false, $fld_flags = false,
$fld_patrolled = false, $fld_tags = false;
public function execute() {
$this->fld_ids = isset( $prop['ids'] );
$this->fld_title = isset( $prop['title'] );
$this->fld_comment = isset( $prop['comment'] );
+ $this->fld_parsedcomment = isset ( $prop['parsedcomment'] );
$this->fld_size = isset( $prop['size'] );
$this->fld_flags = isset( $prop['flags'] );
$this->fld_timestamp = isset( $prop['timestamp'] );
$this->addFieldsIf( 'rev_id', $this->fld_ids || $this->fld_flags );
$this->addFieldsIf( 'page_latest', $this->fld_flags );
// $this->addFieldsIf('rev_text_id', $this->fld_ids); // Should this field be exposed?
- $this->addFieldsIf( 'rev_comment', $this->fld_comment );
+ $this->addFieldsIf( 'rev_comment', $this->fld_comment || $this->fld_parsedcomment );
$this->addFieldsIf( 'rev_len', $this->fld_size );
$this->addFieldsIf( 'rev_minor_edit', $this->fld_flags );
$this->addFieldsIf( 'rev_parent_id', $this->fld_flags );
// $vals['textid'] = intval($row->rev_text_id); // todo: Should this field be exposed?
}
+ $title = Title :: makeTitle( $row->page_namespace, $row->page_title );
+
if ( $this->fld_title )
- ApiQueryBase :: addTitleInfo( $vals,
- Title :: makeTitle( $row->page_namespace, $row->page_title ) );
+ ApiQueryBase :: addTitleInfo( $vals, $title );
if ( $this->fld_timestamp )
$vals['timestamp'] = wfTimestamp( TS_ISO_8601, $row->rev_timestamp );
$vals['top'] = '';
}
- if ( $this->fld_comment && isset( $row->rev_comment ) ) {
+ if ( ($this->fld_comment || $this->fld_parsedcomment) && isset( $row->rev_comment ) ) {
if ( $row->rev_deleted & Revision::DELETED_COMMENT )
$vals['commenthidden'] = '';
- else
- $vals['comment'] = $row->rev_comment;
+ } else {
+ if ( $this->fld_comment )
+ $vals['comment'] = $row->rev_comment;
+
+ if ( $this->fld_parsedcomment ) {
+ global $wgUser;
+ $vals['parsedcomment'] = $wgUser->getSkin()->formatComment( $row->rev_comment, $title );
+ }
+ }
}
if ( $this->fld_patrolled && $row->rc_patrolled )
'title',
'timestamp',
'comment',
+ 'parsedcomment',
'size',
'flags',
'patrolled',
}
private $fld_ids = false, $fld_title = false, $fld_patrol = false, $fld_flags = false,
- $fld_timestamp = false, $fld_user = false, $fld_comment = false, $fld_sizes = false,
+ $fld_timestamp = false, $fld_user = false, $fld_comment = false, $fld_parsedcomment = false, $fld_sizes = false,
$fld_notificationtimestamp = false;
private function run( $resultPageSet = null ) {
$this->fld_flags = isset( $prop['flags'] );
$this->fld_user = isset( $prop['user'] );
$this->fld_comment = isset( $prop['comment'] );
+ $this->fld_parsedcomment = isset ( $prop['parsedcomment'] );
$this->fld_timestamp = isset( $prop['timestamp'] );
$this->fld_sizes = isset( $prop['sizes'] );
$this->fld_patrol = isset( $prop['patrol'] );
$this->addFieldsIf( 'rc_bot', $this->fld_flags );
$this->addFieldsIf( 'rc_user', $this->fld_user );
$this->addFieldsIf( 'rc_user_text', $this->fld_user );
- $this->addFieldsIf( 'rc_comment', $this->fld_comment );
+ $this->addFieldsIf( 'rc_comment', $this->fld_comment || $this->fld_parsedcomment );
$this->addFieldsIf( 'rc_patrolled', $this->fld_patrol );
$this->addFieldsIf( 'rc_old_len', $this->fld_sizes );
$this->addFieldsIf( 'rc_new_len', $this->fld_sizes );
$vals['revid'] = intval( $row->rc_this_oldid );
}
+ $title = Title :: makeTitle( $row->rc_namespace, $row->rc_title );
+
if ( $this->fld_title )
- ApiQueryBase :: addTitleInfo( $vals, Title :: makeTitle( $row->rc_namespace, $row->rc_title ) );
+ ApiQueryBase :: addTitleInfo( $vals, $title );
if ( $this->fld_user ) {
$vals['user'] = $row->rc_user_text;
if ( $this->fld_comment && isset( $row->rc_comment ) )
$vals['comment'] = $row->rc_comment;
+
+ if ( $this->fld_parsedcomment && isset( $row->rc_comment ) ) {
+ global $wgUser;
+ $vals['parsedcomment'] = $wgUser->getSkin()->formatComment( $row->rc_comment, $title );
+ }
return $vals;
}
'flags',
'user',
'comment',
+ 'parsedcomment',
'timestamp',
'patrol',
'sizes',