Merge "rdbms: improve database connection loss handling"
[lhc/web/wiklou.git] / includes / specials / SpecialContributions.php
index 5b939ef..c0303b2 100644 (file)
@@ -21,7 +21,6 @@
  * @ingroup SpecialPage
  */
 
-use MediaWiki\MediaWikiServices;
 use MediaWiki\Widget\DateInputWidget;
 
 /**
@@ -42,9 +41,11 @@ class SpecialContributions extends IncludableSpecialPage {
                $out = $this->getOutput();
                // Modules required for viewing the list of contributions (also when included on other pages)
                $out->addModuleStyles( [
+                       'mediawiki.interface.helpers.styles',
                        'mediawiki.special',
                        'mediawiki.special.changeslist',
                ] );
+               $out->addModules( 'mediawiki.special.recentchanges' );
                $this->addHelpLink( 'Help:User contributions' );
 
                $this->opts = [];
@@ -152,6 +153,15 @@ class SpecialContributions extends IncludableSpecialPage {
                }
                $this->opts = ContribsPager::processDateFilter( $this->opts );
 
+               if ( $this->opts['namespace'] < NS_MAIN ) {
+                       $this->getOutput()->wrapWikiMsg(
+                               "<div class=\"mw-negative-namespace-not-supported error\">\n\$1\n</div>",
+                               [ 'negative-namespace-not-supported' ]
+                       );
+                       $out->addHTML( $this->getForm() );
+                       return;
+               }
+
                $feedType = $request->getVal( 'feed' );
 
                $feedParams = [
@@ -227,8 +237,7 @@ class SpecialContributions extends IncludableSpecialPage {
                                $out->addWikiMsg( 'nocontribs', $target );
                        } else {
                                # Show a message about replica DB lag, if applicable
-                               $lb = MediaWikiServices::getInstance()->getDBLoadBalancer();
-                               $lag = $lb->safeGetLag( $pager->getDatabase() );
+                               $lag = $pager->getDatabase()->getSessionLagStatus()['lag'];
                                if ( $lag > 0 ) {
                                        $out->showLagWarning( $lag );
                                }
@@ -579,6 +588,7 @@ class SpecialContributions extends IncludableSpecialPage {
                        $this->opts['target'],
                        'text',
                        [
+                               'id' => 'mw-target-user-or-ip',
                                'size' => '40',
                                'class' => [
                                        'mw-input',
@@ -598,6 +608,7 @@ class SpecialContributions extends IncludableSpecialPage {
                        $labelNewbies . '<br>' . $labelUsername . ' ' . $input . ' '
                );
 
+               $hidden = $this->opts['namespace'] === '' ? ' mw-input-hidden' : '';
                $namespaceSelection = Xml::tags(
                        'div',
                        [],
@@ -616,11 +627,11 @@ class SpecialContributions extends IncludableSpecialPage {
                        ) . "\u{00A0}" .
                                Html::rawElement(
                                        'span',
-                                       [ 'class' => 'mw-input-with-label' ],
+                                       [ 'class' => 'mw-input-with-label' . $hidden ],
                                        Xml::checkLabel(
                                                $this->msg( 'invert' )->text(),
                                                'nsInvert',
-                                               'nsInvert',
+                                               'nsinvert',
                                                $this->opts['nsInvert'],
                                                [
                                                        'title' => $this->msg( 'tooltip-invert' )->text(),
@@ -628,11 +639,11 @@ class SpecialContributions extends IncludableSpecialPage {
                                                ]
                                        ) . "\u{00A0}"
                                ) .
-                               Html::rawElement( 'span', [ 'class' => 'mw-input-with-label' ],
+                               Html::rawElement( 'span', [ 'class' => 'mw-input-with-label' . $hidden ],
                                        Xml::checkLabel(
                                                $this->msg( 'namespace_association' )->text(),
                                                'associated',
-                                               'associated',
+                                               'nsassociated',
                                                $this->opts['associated'],
                                                [
                                                        'title' => $this->msg( 'tooltip-namespace_association' )->text(),