Merge "rdbms: improve database connection loss handling"
[lhc/web/wiklou.git] / includes / specials / SpecialBlock.php
index 59c14fc..7330e77 100644 (file)
@@ -143,6 +143,8 @@ class SpecialBlock extends FormSpecialPage {
        protected function getFormFields() {
                global $wgBlockAllowsUTEdit;
 
+               $this->getOutput()->enableOOUI();
+
                $user = $this->getUser();
 
                $suggestedDurations = self::getSuggestedDurations();
@@ -177,8 +179,16 @@ class SpecialBlock extends FormSpecialPage {
                                'type' => 'radio',
                                'cssclass' => 'mw-block-editing-restriction',
                                'options' => [
-                                       $this->msg( 'ipb-sitewide' )->escaped() => 'sitewide',
-                                       $this->msg( 'ipb-partial' )->escaped() => 'partial',
+                                       $this->msg( 'ipb-sitewide' )->escaped() .
+                                               new \OOUI\LabelWidget( [
+                                                       'classes' => [ 'oo-ui-inline-help' ],
+                                                       'label' => $this->msg( 'ipb-sitewide-help' )->text(),
+                                               ] ) => 'sitewide',
+                                       $this->msg( 'ipb-partial' )->escaped() .
+                                               new \OOUI\LabelWidget( [
+                                                       'classes' => [ 'oo-ui-inline-help' ],
+                                                       'label' => $this->msg( 'ipb-partial-help' )->text(),
+                                               ] ) => 'partial',
                                ],
                                'section' => 'actions',
                        ];
@@ -189,6 +199,7 @@ class SpecialBlock extends FormSpecialPage {
                                'max' => 10,
                                'cssclass' => 'mw-block-restriction',
                                'showMissing' => false,
+                               'excludeDynamicNamespaces' => true,
                                'input' => [
                                        'autocomplete' => false
                                ],
@@ -309,8 +320,6 @@ class SpecialBlock extends FormSpecialPage {
         * If the user has already been blocked with similar settings, load that block
         * and change the defaults for the form fields to match the existing settings.
         * @param array &$fields HTMLForm descriptor array
-        * @return bool Whether fields were altered (that is, whether the target is
-        *     already blocked)
         */
        protected function maybeAlterFormDefaults( &$fields ) {
                # This will be overwritten by request data
@@ -334,11 +343,11 @@ class SpecialBlock extends FormSpecialPage {
                                || $block->getTarget() == $this->target ) # or if it is, the range is what we're about to block
                ) {
                        $fields['HardBlock']['default'] = $block->isHardblock();
-                       $fields['CreateAccount']['default'] = $block->prevents( 'createaccount' );
+                       $fields['CreateAccount']['default'] = $block->isCreateAccountBlocked();
                        $fields['AutoBlock']['default'] = $block->isAutoblocking();
 
                        if ( isset( $fields['DisableEmail'] ) ) {
-                               $fields['DisableEmail']['default'] = $block->prevents( 'sendemail' );
+                               $fields['DisableEmail']['default'] = $block->isEmailBlocked();
                        }
 
                        if ( isset( $fields['HideUser'] ) ) {
@@ -346,7 +355,7 @@ class SpecialBlock extends FormSpecialPage {
                        }
 
                        if ( isset( $fields['DisableUTEdit'] ) ) {
-                               $fields['DisableUTEdit']['default'] = $block->prevents( 'editownusertalk' );
+                               $fields['DisableUTEdit']['default'] = !$block->isUsertalkEditAllowed();
                        }
 
                        // If the username was hidden (ipb_deleted == 1), don't show the reason
@@ -848,9 +857,9 @@ class SpecialBlock extends FormSpecialPage {
                $block->setBlocker( $performer );
                $block->mReason = $data['Reason'][0];
                $block->mExpiry = $expiryTime;
-               $block->prevents( 'createaccount', $data['CreateAccount'] );
-               $block->prevents( 'editownusertalk', ( !$wgBlockAllowsUTEdit || $data['DisableUTEdit'] ) );
-               $block->prevents( 'sendemail', $data['DisableEmail'] );
+               $block->isCreateAccountBlocked( $data['CreateAccount'] );
+               $block->isUsertalkEditAllowed( !$wgBlockAllowsUTEdit || !$data['DisableUTEdit'] );
+               $block->isEmailBlocked( $data['DisableEmail'] );
                $block->isHardblock( $data['HardBlock'] );
                $block->isAutoblocking( $data['AutoBlock'] );
                $block->mHideName = $data['HideUser'];
@@ -918,12 +927,12 @@ class SpecialBlock extends FormSpecialPage {
 
                                $priorBlock = clone $currentBlock;
                                $currentBlock->isHardblock( $block->isHardblock() );
-                               $currentBlock->prevents( 'createaccount', $block->prevents( 'createaccount' ) );
+                               $currentBlock->isCreateAccountBlocked( $block->isCreateAccountBlocked() );
                                $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->isEmailBlocked( $block->isEmailBlocked() );
+                               $currentBlock->isUsertalkEditAllowed( $block->isUsertalkEditAllowed() );
                                $currentBlock->mReason = $block->mReason;
 
                                if ( $enablePartialBlocks ) {
@@ -975,7 +984,7 @@ class SpecialBlock extends FormSpecialPage {
                }
 
                # Block constructor sanitizes certain block options on insert
-               $data['BlockEmail'] = $block->prevents( 'sendemail' );
+               $data['BlockEmail'] = $block->isEmailBlocked();
                $data['AutoBlock'] = $block->isAutoblocking();
 
                # Prepare log parameters