r13437 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r13436‎ | r13437 | r13438 >
Date:01:32, 3 April 2006
Author:robchurch
Status:old
Tags:
Comment:
Some code cleanup and logic checking
Modified paths:
  • /trunk/phase3/includes/SpecialRecentchanges.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/SpecialRecentchanges.php
@@ -134,18 +134,27 @@
135135 }
136136 }
137137
138 - $hidem = $hideminor ? 'AND rc_minor=0' : '';
139 - $hidem .= $hidebots ? ' AND rc_bot=0' : '';
140 - $hidem .= ( $hideliu && !$hidemyself ) ? ' AND rc_user=0' : '';
141 - $hidem .= $hidepatrolled ? ' AND rc_patrolled=0' : '';
142 - $hidem .= ( $hideanons && !$hideliu ) ? ' AND rc_user <> 0' : '';
143 - if ( $hidemyself ) {
144 - if ( $wgUser->getID() ) {
145 - $hidem .= ' AND rc_user <> '.$wgUser->getID();
 138+ # It makes no sense to hide both anons and logged-in users
 139+ # Where this occurs, force anons to be shown
 140+ if( $hideanons && $hideliu )
 141+ $hideanons = false;
 142+
 143+ # Form WHERE fragments for all the options
 144+ $hidem = $hideminor ? 'AND rc_minor = 0' : '';
 145+ $hidem .= $hidebots ? ' AND rc_bot = 0' : '';
 146+ $hidem .= $hideliu ? ' AND rc_user = 0' : '';
 147+ $hidem .= $hidepatrolled ? ' AND rc_patrolled = 0' : '';
 148+ $hidem .= $hideanons ? ' AND rc_user != 0' : '';
 149+
 150+ if( $hidemyself ) {
 151+ if( $wgUser->getID() ) {
 152+ $hidem .= ' AND rc_user != ' . $wgUser->getID();
146153 } else {
147 - $hidem .= ' AND rc_user_text<>' . $dbr->addQuotes( $wgUser->getName() );
 154+ $hidem .= ' AND rc_user_text != ' . $dbr->addQuotes( $wgUser->getName() );
148155 }
149156 }
 157+
 158+ # Namespace filtering
150159 $hidem .= is_null( $namespace ) ? '' : ' AND rc_namespace' . ($invert ? '!=' : '=') . $namespace;
151160
152161 // This is the big thing!

Status & tagging log