From: Gergő Tisza Date: Tue, 18 Dec 2018 07:50:05 +0000 (-0800) Subject: Include block ID in unblock log X-Git-Tag: 1.34.0-rc.0~3211^2 X-Git-Url: http://git.cyclocoop.org/%7B%7B%20url_for%28%27admin_vote_add%27%29%20%7D%7D?a=commitdiff_plain;h=e829014a1dbbc0745caf670e18bd6caccba987b2;p=lhc%2Fweb%2Fwiklou.git 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 --- 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 );