r112374 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r112373‎ | r112374 | r112375 >
Date:23:39, 24 February 2012
Author:awjrichards
Status:ok (Comments)
Tags:
Comment:
Attempting to address bug 34653; It seems ApiQueryLogEvents has not kept up with changes to the Logging classes. I've changed some aspects of the ApiQueryLogEvents to use a DatabaseLogEntry object when extracting log row information and updated addLogParams to use this new scheme for handling parameters. I have not been able to sufficiently test this and I am still concerned about backwards compatibility with old parameter formats for older log records as well as parameter handling for the 'rights' and 'block' log types.
Modified paths:
  • /trunk/phase3/includes/api/ApiQueryLogEvents.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiQueryLogEvents.php
@@ -198,25 +198,26 @@
199199 * @return array
200200 */
201201 public static function addLogParams( $result, &$vals, $params, $type, $action, $ts ) {
202 - $params = explode( "\n", $params );
203202 switch ( $type ) {
204203 case 'move':
205 - if ( isset( $params[0] ) ) {
206 - $title = Title::newFromText( $params[0] );
 204+ if ( isset( $params[ '4::target' ] ) ) {
 205+ $title = Title::newFromText( $params[ '4::target' ] );
207206 if ( $title ) {
208207 $vals2 = array();
209208 ApiQueryBase::addTitleInfo( $vals2, $title, 'new_' );
210209 $vals[$type] = $vals2;
211210 }
212211 }
213 - if ( isset( $params[1] ) && $params[1] ) {
 212+ if ( isset( $params[ '5::noredir' ] ) && $params[ '5::noredir' ] ) {
214213 $vals[$type]['suppressedredirect'] = '';
215214 }
216215 $params = null;
217216 break;
218217 case 'patrol':
219218 $vals2 = array();
220 - list( $vals2['cur'], $vals2['prev'], $vals2['auto'] ) = $params;
 219+ $vals2[ 'cur' ] = $params[ '4::curid' ];
 220+ $vals2[ 'prev' ] = $params[ '5::previd' ];
 221+ $vals2[ 'auto' ] = $params[ '6::auto' ];
221222 $vals[$type] = $vals2;
222223 $params = null;
223224 break;
@@ -250,6 +251,7 @@
251252 }
252253
253254 private function extractRowInfo( $row ) {
 255+ $logEntry = DatabaseLogEntry::newFromRow( $row );
254256 $vals = array();
255257
256258 if ( $this->fld_ids ) {
@@ -281,10 +283,10 @@
282284 self::addLogParams(
283285 $this->getResult(),
284286 $vals,
285 - $row->log_params,
286 - $row->log_type,
287 - $row->log_action,
288 - $row->log_timestamp
 287+ $logEntry->getParameters(),
 288+ $logEntry->getType(),
 289+ $logEntry->getSubtype(),
 290+ $logEntry->getTimestamp()
289291 );
290292 }
291293 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r112532MFT r112374, r112383, r112397, r112408, r112474reedy22:31, 27 February 2012
r112700Followup r112374/bug 34653...reedy17:50, 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

Comments

#Comment by Reedy (talk | contribs)   17:20, 29 February 2012
I have not been able to sufficiently test this and I am still concerned about backwards compatibility with old parameter formats for older log records as well as parameter handling for the 'rights' and 'block' log types.

Yup, you're right. This fixes it for new log entries, but then breaks it for older entries...

#Comment by Reedy (talk | contribs)   17:25, 29 February 2012
mysql> select * from logging where log_id = 4096837\G
*************************** 1. row ***************************
       log_id: 4096837
     log_type: patrol
   log_action: patrol
log_timestamp: 20120229170153
     log_user: 6122
log_namespace: 0
    log_title: marquises
  log_comment:
   log_params: a:3:{s:8:"4::curid";i:10091973;s:9:"5::previd";i:10091972;s:7:"6::auto";i:1;}
  log_deleted: 0
log_user_text: TAKASUGI Shinji
     log_page: 348496
1 row in set (0.00 sec)

mysql> select * from logging where log_id = 4077622\G
*************************** 1. row ***************************
       log_id: 4077622
     log_type: patrol
   log_action: patrol
log_timestamp: 20120224015248
     log_user: 6122
log_namespace: 0
    log_title: roa-tara
  log_comment:
   log_params: 10074107
0
0
  log_deleted: 0
log_user_text: TAKASUGI Shinji
     log_page: 2378648
1 row in set (0.00 sec)

Status & tagging log