From: Anders Wegge Jakobsen Date: Sat, 27 Aug 2005 23:43:55 +0000 (+0000) Subject: Add filter for robot edits to Special:Watchlist X-Git-Tag: 1.6.0~1775 X-Git-Url: http://git.cyclocoop.org/ecrire?a=commitdiff_plain;h=d41804318e42ea4f1409fe2b390427c2f38f8cc2;p=lhc%2Fweb%2Fwiklou.git Add filter for robot edits to Special:Watchlist --- diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 4348041b46..a7ce7e0319 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -1616,4 +1616,10 @@ $wgEnableScaryTranscluding = false; */ $wgUseTrackbacks = false; +/** + * Enable filtering of robots in Special:Watchlist + */ + +$wgFilterRobotsWL = false; + ?> diff --git a/includes/SpecialWatchlist.php b/includes/SpecialWatchlist.php index c0accdaaae..768bd4673e 100644 --- a/includes/SpecialWatchlist.php +++ b/includes/SpecialWatchlist.php @@ -18,7 +18,7 @@ function wfSpecialWatchlist( $par ) { global $wgUser, $wgOut, $wgLang, $wgTitle, $wgMemc, $wgRequest, $wgContLang; global $wgUseWatchlistCache, $wgWLCacheTimeout, $wgDBname; global $wgRCShowWatchingUsers, $wgEnotifWatchlist, $wgShowUpdatedMarker; - global $wgEnotifWatchlist; + global $wgEnotifWatchlist, $wgFilterRobotsWL; $fname = 'wfSpecialWatchlist'; $wgOut->setPagetitle( wfMsg( 'watchlist' ) ); @@ -36,6 +36,7 @@ function wfSpecialWatchlist( $par ) { $defaults = array( /* float */ 'days' => 3.0, /* or 0.5, watch further below */ /* bool */ 'hideOwn' => false, + /* bool */ 'hideBots' => false, ); extract($defaults); @@ -43,6 +44,7 @@ function wfSpecialWatchlist( $par ) { # Get query variables $days = $wgRequest->getVal( 'days' ); $hideOwn = $wgRequest->getBool( 'hideOwn' ); + $hideBots = $wgRequest->getBool( 'hideBots' ); # Watchlist editing $action = $wgRequest->getVal( 'action' ); @@ -118,6 +120,7 @@ function wfSpecialWatchlist( $par ) { wfAppendToArrayIfNotDefault( 'days', $days, $defaults, $nondefaults); wfAppendToArrayIfNotDefault( 'hideOwn', $hideOwn, $defaults, $nondefaults); + wfAppendToArrayIfNotDefault( 'hideBots', $hideBots, $defaults, $nondefaults); if ( $days <= 0 ) { $docutoff = ''; @@ -202,7 +205,13 @@ function wfSpecialWatchlist( $par ) { # Up estimate of watched items by 15% to compensate for talk pages... $andHideOwn = $hideOwn ? "AND (rc_user <> $uid)" : ''; - + if( $wgFilterRobotsWL ) { + $andHideBotsOptional = $hideBots ? "AND (rc_bot = 0)" : ''; + } else { + $andHideBotsOptional = "AND AND rc_this_oldid=page_latest"; + } + + # Show watchlist header $header = ''; if( $wgUser->getOption( 'enotifwatchlistpages' ) && $wgEnotifWatchlist) { @@ -243,6 +252,7 @@ function wfSpecialWatchlist( $par ) { AND rc_cur_id=page_id AND rc_this_oldid=page_latest $andHideOwn + $andHideBotsOptional ORDER BY rc_timestamp DESC"; $res = $dbr->query( $sql, $fname ); @@ -265,8 +275,15 @@ function wfSpecialWatchlist( $par ) { $wgContLang->specialPage( 'Watchlist' ), (0 == $hideOwn) ? wfMsgHtml( 'wlhide' ) : wfMsgHtml( 'wlshow' ), wfArrayToCGI( array('hideOwn' => 1-$hideOwn ), $nondefaults ) ); - $wgOut->addHTML( wfMsgHtml( "wlhideshowown", $s ) ); + + if( $wgFilterRobotsWL ) { + $s = $sk->makeKnownLink( + $wgContLang->specialPage( 'Watchlist' ), + (0 == $hideBots) ? wfMsgHtml( 'wlhide' ) : wfMsgHtml( 'wlshow' ), + wfArrayToCGI( array('hideBots' => 1-$hideBots ), $nondefaults ) ); + $wgOut->addHTML( wfMsgHtml( "wlhideshowbots", " $s" ) ); + } if ( $numRows == 0 ) { $wgOut->addWikitext( "
" . wfMsg( 'watchnochange' ), false ); diff --git a/languages/Language.php b/languages/Language.php index 5157785e30..adee4944ea 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -1238,6 +1238,7 @@ at the bottom of the screen (deleting a content page also deletes the accompanyi 'wlshowlast' => 'Show last $1 hours $2 days $3', 'wlsaved' => 'This is a saved version of your watchlist.', 'wlhideshowown' => '$1 my edits.', +'wlhideshowown' => '$1 robot edits.', 'wlshow' => 'Show', 'wlhide' => 'Hide', diff --git a/languages/LanguageDa.php b/languages/LanguageDa.php index 29f408e87f..466cd20a1f 100644 --- a/languages/LanguageDa.php +++ b/languages/LanguageDa.php @@ -1035,6 +1035,7 @@ i bunden af skærmen.", 'wlshow' => 'Vis', 'wlhide' => 'Skjul', 'wlhideshowown' => '$1 mine redigeringer.', +'wlhideshowown' => '$1 robotredigeringer.', 'enotif_mailer' => '{{SITENAME}} informationsmail', 'enotif_reset' => 'Marker alle sider som besøgt', 'enotif_newpagetext'=> 'Dette er en ny side.',