&& in_array( $params[3], [ 'revision', 'archive', 'oldimage', 'filearchive' ] )
)
) {
+ // See RevDelList::getLogParams()/RevDelLogList::getLogParams()
$paramStart = $subtype === 'revision' ? 4 : 3;
$old = $this->parseBitField( $params[$paramStart + 1] );
$status->itemStatuses = [];
}
+ // For multi-item deletions, set the old/new bitfields in log_params such that "hid X"
+ // shows in logs if field X was hidden from ANY item and likewise for "unhid Y". Note the
+ // form does not let the same field get hidden and unhidden in different items at once.
+ $virtualOldBits = 0;
+ $virtualNewBits = 0;
$logType = 'delete';
+
// @codingStandardsIgnoreStart Generic.CodeAnalysis.ForLoopWithTestFunctionCall.NotAllowed
for ( $this->reset(); $this->current(); $this->next() ) {
// @codingStandardsIgnoreEnd
if ( ( $oldBits | $newBits ) & $this->getSuppressBit() ) {
$logType = 'suppress';
}
+ // Track which fields where (un)hidden for each item
+ $addedBits = ( $oldBits ^ $newBits ) & $newBits;
+ $removedBits = ( $oldBits ^ $newBits ) & $oldBits;
+ $virtualNewBits |= $addedBits;
+ $virtualOldBits |= $removedBits;
$status->successCount++;
if ( $item->getAuthorId() > 0 ) {
}
// Log it
- // @FIXME: $newBits/$oldBits set in for loop, makes IDE warnings too
$this->updateLog(
$logType,
[
'title' => $this->title,
'count' => $successCount,
- 'newBits' => $newBits,
- 'oldBits' => $oldBits,
+ 'newBits' => $virtualNewBits,
+ 'oldBits' => $virtualOldBits,
'comment' => $comment,
'ids' => $idsForLog,
'authorIds' => $authorIds,