From 9b38eebe0d18203f98191f39835d1674581cac58 Mon Sep 17 00:00:00 2001 From: umherirrender Date: Sun, 23 Mar 2014 17:27:02 +0100 Subject: [PATCH] [Regression] Delete autoblocks when removing autoblock flag Since I5403f6e1d7f8f07273cd5da8068b928fdddcdfc9 on reblock the block will be updated and not deleted/inserted and that update did not trigger a delete of existing autoblocks. Bug: 62748 Change-Id: I50384a41d819689944907e653e2495391253831b --- includes/Block.php | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/includes/Block.php b/includes/Block.php index 3575b9d02a..08428b4261 100644 --- a/includes/Block.php +++ b/includes/Block.php @@ -452,12 +452,22 @@ class Block { $affected = $dbw->affectedRows(); - $dbw->update( - 'ipblocks', - $this->getAutoblockUpdateArray(), - array( 'ipb_parent_block_id' => $this->getId() ), - __METHOD__ - ); + if ( $this->isAutoblocking() ) { + // update corresponding autoblock(s) (bug 48813) + $dbw->update( + 'ipblocks', + $this->getAutoblockUpdateArray(), + array( 'ipb_parent_block_id' => $this->getId() ), + __METHOD__ + ); + } else { + // autoblock no longer required, delete corresponding autoblock(s) + $dbw->delete( + 'ipblocks', + array( 'ipb_parent_block_id' => $this->getId() ), + __METHOD__ + ); + } $dbw->endAtomic( __METHOD__ ); -- 2.20.1