Hi,
I use mediawiki internally for more and more projects... It's really a
great tool, but you allready know that ;-)
Sometimes, i do some small hacks like this one. I wanted to hide my own
changes in "recent changes" special page.
Maybe this patch would interest someone... Or maybe this feature already
exists... In these two cases, there is no more work for me ;-)
Before using it, it should be useful to add "$5 my own changes" in
MediaWiki:Showhideminor page.
This patch was made on mediawiki-1.4-beta6.
--- ../../WikiPato/includes/SpecialRecentchanges.php 2004-12-13
04:19:33.000000000 +0100
+++ SpecialRecentchanges.php 2005-03-10 16:23:45.000000000 +0100
@@ -28,6 +28,7 @@
$days = $wgRequest->getInt( 'days', $defaultDays );
$hideminor = $wgRequest->getBool( 'hideminor',
$wgUser->getOption( 'hideminor' ) ) ? 1 : 0;
+ $hidemyself = $wgRequest->getBool ( 'hidemyself ') ? 1 : 0;
list( $limit, $offset ) = wfCheckLimits( 100, 'rclimit' );
# As a feed, use limited settings only
@@ -36,6 +37,7 @@
$hidebots = 1;
$hideliu = 0;
$hidepatrolled = 0;
+ $hidemyself = 0;
global $wgFeedLimit;
if( $limit > $wgFeedLimit ) {
$limit = $wgFeedLimit;
@@ -45,6 +47,7 @@
$hidebots = $wgRequest->getBool( 'hidebots', true ) ? 1
: 0;
$hideliu = $wgRequest->getBool( 'hideliu', false ) ? 1 : 0;
$hidepatrolled = $wgRequest->getBool( 'hidepatrolled',
false ) ? 1 : 0;
+ $hidemyself = $wgRequest->getBool( 'hidemyself') ? 1 : 0;
# Get query parameters from path
if( $par ) {
@@ -55,6 +58,7 @@
if( in_array( 'minor', $bits ) ) $hideminor = 0;
if( in_array( 'hideliu', $bits) ) $hideliu = 1;
if( in_array( 'hidepatrolled', $bits) )
$hidepatrolled = 1;
+ if( in_array( 'hidemyself', $bits) ) $hidemyself
= 1;
}
}
@@ -98,12 +102,13 @@
$hidem = ( $hideminor ) ? 'AND rc_minor=0' : '';
$hidem .= ( $hidebots ) ? ' AND rc_bot=0' : '';
- $hidem .= ( $hideliu ) ? ' AND rc_user=0' : '';
+ $hidem .= ( $hideliu && !$hidemyself) ? ' AND rc_user=0' :
'';
$hidem .= ( $hidepatrolled )? ' AND rc_patrolled=0' : '';
+ $hidem .= ( $hidemyself ) ? ' AND rc_user <> '.$wgUser->getID
() : '';
$urlparams = array( 'hideminor' => $hideminor, 'hideliu'
=> $hideliu,
'hidebots' => $hidebots,
'hidepatrolled'
=> $hidepatrolled,
- 'limit' => $limit );
+ 'limit' => $limit, 'hidemyself' =>
$hidemyself );
$hideparams = wfArrayToCGI( $urlparams );
$minorLink = $sk->makeKnownLink( $wgContLang->specialPage(
'Recentchanges' ),
@@ -114,6 +119,8 @@
$showhide[1-$hideliu], wfArrayToCGI( array( 'hideliu' =>
1-$hideliu ), $urlparams ) );
$patrLink = $sk->makeKnownLink( $wgContLang->specialPage(
'Recentchanges' ),
$showhide[1-$hidepatrolled], wfArrayToCGI( array(
'hidepatrolled' => 1-$hidepatrolled ), $urlparams ) );
+ $myselfLink = $sk->makeKnownLink( $wgContLang->specialPage(
'Recentchanges' ),
+ $showhide[1-$hidemyself], wfArrayToCGI( array( 'hidemyself' =>
1-$hidemyself ), $urlparams ) );
$uid = $wgUser->getID();
$sql2 = "SELECT $recentchanges.*" . ($uid ? ",wl_user" :
"") .
" FROM $recentchanges " .
@@ -136,7 +143,7 @@
}
$wgOut->addHTML( "\n<hr />\n{$note}\n<br />" );
- $note = rcDayLimitLinks( $days, $limit, 'Recentchanges',
$hideparams, false, $minorLink, $botLink, $liuLink, $patrLink );
+ $note = rcDayLimitLinks( $days, $limit, 'Recentchanges',
$hideparams, false, $minorLink, $botLink, $liuLink, $patrLink,
$myselfLink );
$note .= "<br />\n" . wfMsg( 'rclistfrom',
$sk->makeKnownLink( $wgContLang->specialPage( 'Recentchanges' ),
@@ -295,7 +302,7 @@
* Used also by Recentchangeslinked
*/
function rcDayLimitLinks( $days, $limit, $page='Recentchanges',
$more='', $doall = false, $minorLink = '',
- $botLink = '', $liuLink = '', $patrLink = '' ) {
+ $botLink = '', $liuLink = '', $patrLink = '', $mslfLink )
{
if ($more != '') $more .= '&';
$cl = rcCountLink( 50, $days, $page, $more ) . ' | ' .
rcCountLink( 100, $days, $page, $more ) . ' | ' .
@@ -308,7 +315,7 @@
rcDaysLink( $limit, 14, $page, $more ) . ' | ' .
rcDaysLink( $limit, 30, $page, $more ) .
( $doall ? ( ' | ' . rcDaysLink( $limit, 0, $page, $more ) )
: '' );
- $shm = wfMsg( 'showhideminor', $minorLink, $botLink, $liuLink,
$patrLink );
+ $shm = wfMsg( 'showhideminor', $minorLink, $botLink, $liuLink,
$patrLink, $mslfLink );
$note = wfMsg( 'rclinks', $cl, $dl, $shm );
return $note;
}
--
Jonathan ILIAS, assistant pédagogique
http://www.eseo.fr/~jilias/
ESEO
4, rue Merlet de la Boulaye
BP 30926 - 49009 ANGERS cedex 01 - FRANCE
tél : 02 41 86 67 60