} elseif ( !$pager->getNumRows() ) {
$out->addWikiMsg( 'nocontribs', $target );
} else {
- # Show a message about replica DB lag, if applicable
- $lb = MediaWikiServices::getInstance()->getDBLoadBalancer();
- $lag = $lb->safeGetLag( $pager->getDatabase() );
- if ( $lag > 0 ) {
- $out->showLagWarning( $lag );
- }
-
- $output = $pager->getBody();
- if ( !$this->including() ) {
- $output = '<p>' . $pager->getNavigationBar() . '</p>' .
- $output .
- '<p>' . $pager->getNavigationBar() . '</p>';
+ // @todo We just want a wiki ID here, not a "DB domain", but
+ // current status of MediaWiki conflates the two. See T235955.
+ $poolKey = WikiMap::getCurrentWikiDbDomain() . ':SpecialContributions:';
+ if ( $this->getUser()->isAnon() ) {
+ $poolKey .= 'a:' . $this->getUser()->getName();
+ } else {
+ $poolKey .= 'u:' . $this->getUser()->getId();
}
- $out->addHTML( $output );
+ $work = new PoolCounterWorkViaCallback( 'SpecialContributions', $poolKey, [
+ 'doWork' => function () use ( $pager, $out ) {
+ # Show a message about replica DB lag, if applicable
+ $lb = MediaWikiServices::getInstance()->getDBLoadBalancer();
+ $lag = $lb->safeGetLag( $pager->getDatabase() );
+ if ( $lag > 0 ) {
+ $out->showLagWarning( $lag );
+ }
+
+ $output = $pager->getBody();
+ if ( !$this->including() ) {
+ $output = '<p>' . $pager->getNavigationBar() . '</p>' .
+ $output .
+ '<p>' . $pager->getNavigationBar() . '</p>';
+ }
+ $out->addHTML( $output );
+ },
+ 'error' => function () use ( $out ) {
+ $msg = $this->getUser()->isAnon()
+ ? 'sp-contributions-concurrency-ip'
+ : 'sp-contributions-concurrency-user';
+ $out->wrapWikiMsg( "<div class='errorbox'>\n$1\n</div>", $msg );
+ }
+ ] );
+ $work->execute();
}
$out->preventClickjacking( $pager->getPreventClickjacking() );
"sp-contributions-footer-anon-range": "-",
"sp-contributions-footer-newbies": "-",
"sp-contributions-outofrange": "Unable to show any results. The requested IP range is larger than the CIDR limit of /$1.",
+ "sp-contributions-concurrency-user": "Sorry, too many requests are being made from your user account. Please try again later.",
+ "sp-contributions-concurrency-ip": "Sorry, too many requests are being made from your IP address. Please try again later.",
"whatlinkshere": "What links here",
"whatlinkshere-title": "Pages that link to \"$1\"",
"whatlinkshere-summary": "",
"sp-contributions-footer-anon-range": "{{ignored}}This is the footer for IP ranges on [[Special:Contributions]].",
"sp-contributions-footer-newbies": "{{ignored}}This is the footer for newbie users on [[Special:Contributions]].",
"sp-contributions-outofrange": "Message shown when a user tries to view contributions of an IP range that's too large. $1 is the numerical limit imposed on the CIDR range.",
+ "sp-contributions-concurrency-user": "Message shown when a logged-in user tries to load [[Special:Contributions]] too many times at once.",
+ "sp-contributions-concurrency-ip": "Message shown when a logged-out user tries to load [[Special:Contributions]] too many times at once.",
"whatlinkshere": "The text of the link in the toolbox (on the left, below the search menu) going to [[Special:WhatLinksHere]].\n\nSee also:\n* {{msg-mw|Whatlinkshere}}\n* {{msg-mw|Accesskey-t-whatlinkshere}}\n* {{msg-mw|Tooltip-t-whatlinkshere}}",
"whatlinkshere-title": "Title of the special page [[Special:WhatLinksHere]]. This page appears when you click on the 'What links here' button in the toolbox. $1 is the name of the page concerned.",
"whatlinkshere-summary": "{{doc-specialpagesummary|whatlinkshere}}",