r88493 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r88492‎ | r88493 | r88494 >
Date:21:47, 20 May 2011
Author:reedy
Status:ok (Comments)
Tags:
Comment:
* (bug 20699) API watchlist should list log-events

Also add "loginfo" from recentchanges/logevents
Modified paths:
  • /trunk/phase3/RELEASE-NOTES-1.19 (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryWatchlist.php (modified) (history)

Diff [purge]

Index: trunk/phase3/RELEASE-NOTES-1.19
@@ -79,6 +79,7 @@
8080 * (bug 27593) API: add error message when sha1/sha1base36 is invalid
8181 * (bug 28578) API's parse module should not silently override invalid
8282 title inputs
 83+* (bug 20699) API watchlist should list log-events
8384
8485 === Languages updated in 1.19 ===
8586
Index: trunk/phase3/includes/api/ApiQueryWatchlist.php
@@ -51,7 +51,7 @@
5252
5353 private $fld_ids = false, $fld_title = false, $fld_patrol = false, $fld_flags = false,
5454 $fld_timestamp = false, $fld_user = false, $fld_comment = false, $fld_parsedcomment = false, $fld_sizes = false,
55 - $fld_notificationtimestamp = false, $fld_userid = false;
 55+ $fld_notificationtimestamp = false, $fld_userid = false, $fld_loginfo = false;
5656
5757 /**
5858 * @param $resultPageSet ApiPageSet
@@ -78,6 +78,7 @@
7979 $this->fld_sizes = isset( $prop['sizes'] );
8080 $this->fld_patrol = isset( $prop['patrol'] );
8181 $this->fld_notificationtimestamp = isset( $prop['notificationtimestamp'] );
 82+ $this->fld_loginfo = isset( $prop['loginfo'] );
8283
8384 if ( $this->fld_patrol ) {
8485 if ( !$user->useRCPatrol() && !$user->useNPPatrol() ) {
@@ -89,7 +90,8 @@
9091 $this->addFields( array(
9192 'rc_namespace',
9293 'rc_title',
93 - 'rc_timestamp'
 94+ 'rc_timestamp',
 95+ 'rc_type',
9496 ) );
9597
9698 if ( is_null( $resultPageSet ) ) {
@@ -108,6 +110,10 @@
109111 $this->addFieldsIf( 'rc_old_len', $this->fld_sizes );
110112 $this->addFieldsIf( 'rc_new_len', $this->fld_sizes );
111113 $this->addFieldsIf( 'wl_notificationtimestamp', $this->fld_notificationtimestamp );
 114+ $this->addFieldsIf( 'rc_logid', $this->fld_loginfo );
 115+ $this->addFieldsIf( 'rc_log_type', $this->fld_loginfo );
 116+ $this->addFieldsIf( 'rc_log_action', $this->fld_loginfo );
 117+ $this->addFieldsIf( 'rc_params', $this->fld_loginfo );
112118 } elseif ( $params['allrev'] ) {
113119 $this->addFields( 'rc_this_oldid' );
114120 } else {
@@ -139,7 +145,7 @@
140146 $db->timestamp( $params['start'] ),
141147 $db->timestamp( $params['end'] ) );
142148 $this->addWhereFld( 'wl_namespace', $params['namespace'] );
143 - $this->addWhereIf( 'rc_this_oldid=page_latest', !$params['allrev'] );
 149+ $this->addWhereIf( 'rc_this_oldid=page_latest OR rc_type=' . RC_LOG, !$params['allrev'] );
144150
145151 if ( !is_null( $params['show'] ) ) {
146152 $show = array_flip( $params['show'] );
@@ -294,6 +300,17 @@
295301 $vals['parsedcomment'] = $wgUser->getSkin()->formatComment( $row->rc_comment, $title );
296302 }
297303
 304+ if ( $this->fld_loginfo && $row->rc_type == RC_LOG ) {
 305+ $vals['logid'] = intval( $row->rc_logid );
 306+ $vals['logtype'] = $row->rc_log_type;
 307+ $vals['logaction'] = $row->rc_log_action;
 308+ ApiQueryLogEvents::addLogParams(
 309+ $this->getResult(),
 310+ $vals, $row->rc_params,
 311+ $row->rc_log_type, $row->rc_timestamp
 312+ );
 313+ }
 314+
298315 return $vals;
299316 }
300317
@@ -344,7 +361,8 @@
345362 'timestamp',
346363 'patrol',
347364 'sizes',
348 - 'notificationtimestamp'
 365+ 'notificationtimestamp',
 366+ 'loginfo',
349367 )
350368 ),
351369 'show' => array(
@@ -393,6 +411,7 @@
394412 ' patrol - Tags edits that are patrolled',
395413 ' size - Adds the old and new lengths of the page',
396414 ' notificationtimestamp - Adds timestamp of when the user was last notified about the edit',
 415+ ' loginfo - Adds log information where appropriate',
397416 ),
398417 'show' => array(
399418 'Show only items that meet this criteria.',

Follow-up revisions

RevisionCommit summaryAuthorDate
r94062Followup r88488, moved some of the prep work in it that was for r88493...reedy16:20, 8 August 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r88488Similarise queries to that of SpecialWatchlistreedy21:30, 20 May 2011

Comments

#Comment by Krinkle (talk | contribs)   16:10, 21 May 2011

Including this commit, it's becoming more like ApiQueryRecentChanges, perhaps we can straighten out more difference (if any) ?

#Comment by Reedy (talk | contribs)   15:40, 25 June 2011

Maybe we could, but need to keep back compat

Though, surely the same could be said about SpecialWatchlist/SpecialRecentchanges, which are completely separate...

Status & tagging log