r112700 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r112699‎ | r112700 | r112701 >
Date:17:50, 29 February 2012
Author:reedy
Status:ok (Comments)
Tags:
Comment:
Followup r112374/bug 34653

We still get legacy log entries, so grab the data from parameters as applicable

Should probably be encapsulated into DatabaseLogEntry itself, with a getParamValue esk wrapper

This fixes issues noticed on live site for the moment

TODO: Check if rights/block are still ok (probably not?)
TODO: If (especially if above needs doing) encapsulate grabbing of old/new parameters to logging code
Modified paths:
  • /trunk/phase3/includes/api/ApiQueryLogEvents.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiQueryLogEvents.php
@@ -197,27 +197,44 @@
198198 * @param $ts
199199 * @return array
200200 */
201 - public static function addLogParams( $result, &$vals, $params, $type, $action, $ts ) {
 201+ public static function addLogParams( $result, &$vals, $params, $type, $action, $ts, $legacy = false ) {
202202 switch ( $type ) {
203203 case 'move':
204 - if ( isset( $params[ '4::target' ] ) ) {
205 - $title = Title::newFromText( $params[ '4::target' ] );
 204+ if ( $legacy ){
 205+ $targetKey = 0;
 206+ $noredirKey = 1;
 207+ } else {
 208+ $targetKey = '4::target';
 209+ $noredirKey = '5::noredir';
 210+ }
 211+
 212+ if ( isset( $params[ $targetKey ] ) ) {
 213+ $title = Title::newFromText( $params[ $targetKey ] );
206214 if ( $title ) {
207215 $vals2 = array();
208216 ApiQueryBase::addTitleInfo( $vals2, $title, 'new_' );
209217 $vals[$type] = $vals2;
210218 }
211219 }
212 - if ( isset( $params[ '5::noredir' ] ) && $params[ '5::noredir' ] ) {
 220+ if ( isset( $params[ $noredirKey ] ) && $params[ $noredirKey ] ) {
213221 $vals[$type]['suppressedredirect'] = '';
214222 }
215223 $params = null;
216224 break;
217225 case 'patrol':
 226+ if ( $legacy ){
 227+ $cur = 0;
 228+ $prev = 1;
 229+ $auto = 2;
 230+ } else {
 231+ $cur = '4::curid';
 232+ $prev = '5::previd';
 233+ $auto = '6::auto';
 234+ }
218235 $vals2 = array();
219 - $vals2[ 'cur' ] = $params[ '4::curid' ];
220 - $vals2[ 'prev' ] = $params[ '5::previd' ];
221 - $vals2[ 'auto' ] = $params[ '6::auto' ];
 236+ $vals2['cur'] = $params[$cur];
 237+ $vals2['prev'] = $params[$prev];
 238+ $vals2['auto'] = $params[$auto];
222239 $vals[$type] = $vals2;
223240 $params = null;
224241 break;
@@ -286,7 +303,8 @@
287304 $logEntry->getParameters(),
288305 $logEntry->getType(),
289306 $logEntry->getSubtype(),
290 - $logEntry->getTimestamp()
 307+ $logEntry->getTimestamp(),
 308+ $logEntry->isLegacy()
291309 );
292310 }
293311 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r112701MFT r112700reedy17:52, 29 February 2012
r113040MFT r111427, r112347, r112374, r112383, r112700, r112750, r112855reedy15:15, 5 March 2012

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r112372Attempting to address bug 34653; It seems ApiQueryLogEvents has not kept up w...awjrichards23:36, 24 February 2012
r112374Attempting to address bug 34653; It seems ApiQueryLogEvents has not kept up w...awjrichards23:39, 24 February 2012

Comments

#Comment by Reedy (talk | contribs)   18:51, 29 February 2012

Block:

      <item logid="358884" pageid="0" ns="2" title="User:Tavoniko" type="block" action="block" user="Reedy" timestamp="2010-08-05T06:59:12Z" comment="Spamming">
        <block flags="nocreate" duration="infinite" />
      </item>
      <item logid="605625" pageid="42049" ns="2" title="User:Reedy" type="block" action="block" user="Reedy" timestamp="2012-02-29T18:51:15Z" comment="Test">
        <block flags="noautoblock" duration="5 seconds" expiry="2012-02-29T18:51:20Z" />
      </item>
      <item logid="605623" pageid="0" ns="2" title="User:Reedy Bot" type="block" action="block" user="Reedy" timestamp="2012-02-29T18:51:02Z" comment="Test">
        <block flags="noautoblock" duration="5 seconds" expiry="2012-02-29T18:51:07Z" />
      </item>
#Comment by Reedy (talk | contribs)   18:54, 29 February 2012

Rights:

      <item logid="596568" pageid="80772" ns="2" title="User:Krenair" type="rights" action="rights" user="Reedy" timestamp="2012-02-20T20:41:05Z" comment="Active user on irc">
        <rights new="sysop" old="" />
      </item>
      <item logid="605629" pageid="0" ns="2" title="User:Reedy Bot" type="rights" action="rights" user="Reedy" timestamp="2012-02-29T18:52:37Z" comment="">
        <rights new="" old="sysop" />
      </item>
      <item logid="605627" pageid="0" ns="2" title="User:Reedy Bot" type="rights" action="rights" user="Reedy" timestamp="2012-02-29T18:52:02Z" comment="">
        <rights new="sysop" old="" />
      </item>


To me, it would look like both Block and rights are fine... So this strikes the first TODO. And the 2nd becomes slightly less important

Status & tagging log