From e829014a1dbbc0745caf670e18bd6caccba987b2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Gerg=C5=91=20Tisza?= Date: Mon, 17 Dec 2018 23:50:05 -0800 Subject: [PATCH] Include block ID in unblock log Also change block log to only include the ID of the block. Including autoblock IDs just makes analysis harder, and it is not useful when searching for autoblocks since those created when a blocked user tries to edit are not logged this way. Bug: T210476 Change-Id: Iff1697be416abbb807227d0629cf41346bd379c2 --- includes/specials/SpecialBlock.php | 8 +++++--- includes/specials/SpecialUnblock.php | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/includes/specials/SpecialBlock.php b/includes/specials/SpecialBlock.php index 67d1873659..c9ce2b0837 100644 --- a/includes/specials/SpecialBlock.php +++ b/includes/specials/SpecialBlock.php @@ -882,6 +882,7 @@ class SpecialBlock extends FormSpecialPage { } $status = $currentBlock->update(); + // TODO handle failure $logaction = 'reblock'; @@ -894,6 +895,8 @@ class SpecialBlock extends FormSpecialPage { if ( (bool)$currentBlock->mHideName ) { $data['HideUser'] = true; } + + $block = $currentBlock; } } else { $logaction = 'block'; @@ -938,9 +941,8 @@ class SpecialBlock extends FormSpecialPage { $logEntry->setComment( $data['Reason'][0] ); $logEntry->setPerformer( $performer ); $logEntry->setParameters( $logParams ); - # Relate log ID to block IDs (T27763) - $blockIds = array_merge( [ $status['id'] ], $status['autoIds'] ); - $logEntry->setRelations( [ 'ipb_id' => $blockIds ] ); + # Relate log ID to block ID (T27763) + $logEntry->setRelations( [ 'ipb_id' => $block->getId() ] ); $logId = $logEntry->insert(); if ( !empty( $data['Tags'] ) ) { diff --git a/includes/specials/SpecialUnblock.php b/includes/specials/SpecialUnblock.php index b2d5a1633b..632415cc1d 100644 --- a/includes/specials/SpecialUnblock.php +++ b/includes/specials/SpecialUnblock.php @@ -248,6 +248,7 @@ class SpecialUnblock extends SpecialPage { if ( isset( $data['Tags'] ) ) { $logEntry->setTags( $data['Tags'] ); } + $logEntry->setRelations( [ 'ipb_id' => $block->getId() ] ); $logId = $logEntry->insert(); $logEntry->publish( $logId ); -- 2.20.1