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
$affected = $dbw->affectedRows();
$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__ );
$dbw->endAtomic( __METHOD__ );