$vals['pageid'] = intval( $row->page_id );
$vals['logpage'] = intval( $row->log_page );
}
- if ( $this->fld_details && $row->log_params !== '' ) {
- $vals['params'] = LogFormatter::newFromRow( $row )->formatParametersForApi();
+ if ( $this->fld_details ) {
+ $vals['params'] = LogFormatter::newFromEntry( $logEntry )->formatParametersForApi();
}
}
}
}
}
- if ( isset( $params['6:array:flags'] ) && !is_array( $params['6:array:flags'] ) ) {
- $params['6:array:flags'] = $params['6:array:flags'] === ''
- ? array()
- : explode( ',', $params['6:array:flags'] );
- }
+ $subtype = $entry->getSubtype();
+ if ( $subtype === 'block' || $subtype === 'reblock' ) {
+ // Defaults for old log entries missing some fields
+ $params += array(
+ '5::duration' => 'infinite',
+ '6:array:flags' => array(),
+ );
+
+ if ( !is_array( $params['6:array:flags'] ) ) {
+ $params['6:array:flags'] = $params['6:array:flags'] === ''
+ ? array()
+ : explode( ',', $params['6:array:flags'] );
+ }
- if ( isset( $params['5::duration'] ) &&
- SpecialBlock::parseExpiryInput( $params['5::duration'] ) !== wfGetDB( DB_SLAVE )->getInfinity()
- ) {
- $ts = wfTimestamp( TS_UNIX, $entry->getTimestamp() );
- $params[':timestamp:expiry'] = strtotime( $params['5::duration'], $ts );
+ if ( !wfIsInfinity( $params['5::duration'] ) ) {
+ $ts = wfTimestamp( TS_UNIX, $entry->getTimestamp() );
+ $expiry = strtotime( $params['5::duration'], $ts );
+ if ( $expiry !== false && $expiry > 0 ) {
+ $params[':timestamp:expiry'] = $expiry;
+ }
+ }
}
return $params;