From: umherirrender Date: Sun, 23 Mar 2014 16:27:02 +0000 (+0100) Subject: [Regression] Delete autoblocks when removing autoblock flag X-Git-Tag: 1.31.0-rc.0~16525^2 X-Git-Url: https://git.cyclocoop.org/%27.%24link.%27?a=commitdiff_plain;h=9b38eebe0d18203f98191f39835d1674581cac58;p=lhc%2Fweb%2Fwiklou.git [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 --- 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__ );