From: Rob Church Date: Fri, 18 May 2007 20:17:53 +0000 (+0000) Subject: * (bug 9628) Show warnings about slave lag on Special:Contributions, Special:Watchlis... X-Git-Tag: 1.31.0-rc.0~52879 X-Git-Url: http://git.cyclocoop.org/%24action?a=commitdiff_plain;h=8b5fbb8f6e9a88d0cfbd875d3cf393f6b245b544;p=lhc%2Fweb%2Fwiklou.git * (bug 9628) Show warnings about slave lag on Special:Contributions, Special:Watchlist - adding this to other pages is quite simple * A little release notes tweaking --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 1533729b5e..26e7b0310e 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -20,15 +20,17 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN == Configuration changes since 1.10 == - == New features since 1.10 == * (bug 8868) Separate "blocked" message for autoblocks * Adding expiry of block to block messages * Bulk mail options ($wgEnotifImpersonal, $wgEnotifUseJobQ) for large sites -* Links to redirect pages in categories are wrapped in -* New hook "ImageOpenShowImageInlineBefore" in ImagePage.php in openShowImage() +* Links to redirect pages in categories are wrapped in + +* Introduced 'ImageOpenShowImageInlineBefore' hook; see docs/hooks.txt for + more information +* (bug 9628) Show warnings about slave lag on Special:Contributions, + Special:Watchlist == Bugfixes since 1.10 == diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index de3cdaa819..a4ea5903fb 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -1125,7 +1125,7 @@ $wgCacheEpoch = '20030516000000'; * to ensure that client-side caches don't keep obsolete copies of global * styles. */ -$wgStyleVersion = '71'; +$wgStyleVersion = '72'; # Server-side caching: diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 42c1b4c2a7..397d5214f5 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -1233,5 +1233,21 @@ class OutputPage { public function showNewSectionLink() { return $this->mNewSectionLink; } + + /** + * Show a warning about slave lag + * + * If the lag is higher than 30 seconds, then the warning is + * a bit more obvious + * + * @param int $lag Slave lag + */ + public function showLagWarning( $lag ) { + $message = $lag >= 30 ? 'lag-warn-high' : 'lag-warn-normal'; + $warning = wfMsgHtml( $message, htmlspecialchars( $lag ) ); + $this->addHtml( "
\n{$warning}\n
\n" ); + } + } -?> + +?> \ No newline at end of file diff --git a/includes/SpecialContributions.php b/includes/SpecialContributions.php index c3db78bd9a..d2d9b03f8f 100644 --- a/includes/SpecialContributions.php +++ b/includes/SpecialContributions.php @@ -157,6 +157,16 @@ class ContribsPager extends IndexPager { wfProfileOut( __METHOD__ ); return $ret; } + + /** + * Get the Database object in use + * + * @return Database + */ + public function getDatabase() { + return $this->mDb; + } + } /** @@ -226,6 +236,11 @@ function wfSpecialContributions( $par = null ) { $wgOut->addWikiText( wfMsg( 'nocontribs' ) ); return; } + + # Show a message about slave lag, if applicable + if( ( $lag = $pager->getDatabase()->getLag() ) > 0 ) + $wgOut->showLagWarning( $lag ); + $wgOut->addHTML( '

' . $pager->getNavigationBar() . '

' . $pager->getBody() . diff --git a/includes/SpecialWatchlist.php b/includes/SpecialWatchlist.php index 2e660bd56d..403ee8fefe 100644 --- a/includes/SpecialWatchlist.php +++ b/includes/SpecialWatchlist.php @@ -267,6 +267,10 @@ function wfSpecialWatchlist( $par ) { $wgLang->formatNum( $npages ), '', $specialTitle->getFullUrl( 'edit=yes' ) ); $wgOut->addWikiText( $header ); + + # Show a message about slave lag, if applicable + if( ( $lag = $dbr->getLag() ) > 0 ) + $wgOut->showLagWarning( $lag ); if ( $wgEnotifWatchlist && $wgShowUpdatedMarker ) { $wgOut->addHTML( '
"Failed to connect: $1 \"$2\"\nTry normal preview.", +# Friendlier slave lag warnings +'lag-warn-normal' => 'Changes newer than $1 seconds may not be shown in this list.', +'lag-warn-high' => 'Due to high database server lag, changes newer than $1 seconds +may not be shown in this list.', + ); ?> diff --git a/skins/monobook/main.css b/skins/monobook/main.css index 31983308c5..4b9dd358df 100644 --- a/skins/monobook/main.css +++ b/skins/monobook/main.css @@ -1593,6 +1593,24 @@ p.mw-ipb-conveniencelinks { float: right; } +/* Friendlier slave lag warnings */ +div.mw-lag-warn-normal, +div.mw-lag-warn-high { + width: 75%; + padding: 3px; + text-align: center; + margin: 3px auto; +} +div.mw-lag-warn-normal { + border: 1px solid #FFCC66; + background-color: #FFFFCC; +} +div.mw-lag-warn-high { + font-weight: bold; + border: 2px solid #CC3333; + background-color: #CC9999; +} + /** * Here is some stuff that's ACTUALLY COMMON TO ALL SKINS. * When the day comes, it can be moved to a *real* common.css.