Make autoblocks update with the parent block
[lhc/web/wiklou.git] / includes / specials / SpecialBlock.php
index 5a2ad62..beb4d4c 100644 (file)
@@ -726,8 +726,17 @@ class SpecialBlock extends FormSpecialPage {
                                        return array( 'cant-see-hidden-user' );
                                }
 
-                               $currentBlock->delete();
-                               $status = $block->insert();
+                               $currentBlock->isHardblock( $block->isHardblock() );
+                               $currentBlock->prevents( 'createaccount', $block->prevents( 'createaccount' ) );
+                               $currentBlock->mExpiry = $block->mExpiry;
+                               $currentBlock->isAutoblocking( $block->isAutoblocking() );
+                               $currentBlock->mHideName = $block->mHideName;
+                               $currentBlock->prevents( 'sendemail', $block->prevents( 'sendemail' ) );
+                               $currentBlock->prevents( 'editownusertalk', $block->prevents( 'editownusertalk' ) );
+                               $currentBlock->mReason = $block->mReason;
+
+                               $status = $currentBlock->update();
+
                                $logaction = 'reblock';
 
                                # Unset _deleted fields if requested
@@ -753,7 +762,7 @@ class SpecialBlock extends FormSpecialPage {
 
                # Can't watch a rangeblock
                if ( $type != Block::TYPE_RANGE && $data['Watch'] ) {
-                       $performer->addWatch( Title::makeTitle( NS_USER, $target ) );
+                       WatchAction::doWatch( Title::makeTitle( NS_USER, $target ), $performer, WatchedItem::IGNORE_USER_RIGHTS );
                }
 
                # Block constructor sanitizes certain block options on insert
@@ -772,7 +781,8 @@ class SpecialBlock extends FormSpecialPage {
                        $logaction,
                        Title::makeTitle( NS_USER, $target ),
                        $data['Reason'][0],
-                       $logParams
+                       $logParams,
+                       $performer
                );
                # Relate log ID to block IDs (bug 25763)
                $blockIds = array_merge( array( $status['id'] ), $status['autoIds'] );