jenkins-bot has submitted this change and it was merged.

Change subject: [Regression] Delete autoblocks when removing autoblock flag
......................................................................


[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
---
M includes/Block.php
1 file changed, 16 insertions(+), 6 deletions(-)

Approvals:
  Aaron Schulz: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/Block.php b/includes/Block.php
index 3575b9d..08428b4 100644
--- a/includes/Block.php
+++ b/includes/Block.php
@@ -452,12 +452,22 @@
 
                $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__ );
 

-- 
To view, visit https://gerrit.wikimedia.org/r/120386
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I50384a41d819689944907e653e2495391253831b
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Umherirrender <[email protected]>
Gerrit-Reviewer: Aaron Schulz <[email protected]>
Gerrit-Reviewer: Parent5446 <[email protected]>
Gerrit-Reviewer: Platonides <[email protected]>
Gerrit-Reviewer: Umherirrender <[email protected]>
Gerrit-Reviewer: coren <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to