Index: trunk/phase3/includes/specials/SpecialWatchlist.php |
— | — | @@ -155,10 +155,13 @@ |
156 | 156 | return; |
157 | 157 | } |
158 | 158 | |
| 159 | + # Possible where conditions |
| 160 | + $conds = array(); |
| 161 | + |
159 | 162 | if( $days <= 0 ) { |
160 | 163 | $andcutoff = ''; |
161 | 164 | } else { |
162 | | - $andcutoff = "rc_timestamp > '".$dbr->timestamp( time() - intval( $days * 86400 ) )."'"; |
| 165 | + $conds[] = "rc_timestamp > '".$dbr->timestamp( time() - intval( $days * 86400 ) )."'"; |
163 | 166 | } |
164 | 167 | |
165 | 168 | # If the watchlist is relatively short, it's simplest to zip |
— | — | @@ -170,21 +173,32 @@ |
171 | 174 | # Up estimate of watched items by 15% to compensate for talk pages... |
172 | 175 | |
173 | 176 | # Toggles |
174 | | - $andHideOwn = $hideOwn ? "rc_user != $uid" : ''; |
175 | | - $andHideBots = $hideBots ? "rc_bot = 0" : ''; |
176 | | - $andHideMinor = $hideMinor ? "rc_minor = 0" : ''; |
177 | | - $andHideLiu = $hideLiu ? "rc_user = 0" : ''; |
178 | | - $andHideAnons = $hideAnons ? "rc_user != 0" : ''; |
179 | | - $andHidePatrolled = $wgUser->useRCPatrol() && $hidePatrolled ? "rc_patrolled != 1" : ''; |
| 177 | + if( $hideOwn ) { |
| 178 | + $conds[] = "rc_user != $uid"; |
| 179 | + } |
| 180 | + if( $hideBots ) { |
| 181 | + $conds[] = 'rc_bot = 0'; |
| 182 | + } |
| 183 | + if( $hideMinor ) { |
| 184 | + $conds[] = 'rc_minor = 0'; |
| 185 | + } |
| 186 | + if( $hideLiu ) { |
| 187 | + $conds[] = 'rc_user = 0'; |
| 188 | + } |
| 189 | + if( $hideAnons ) { |
| 190 | + $conds[] = 'rc_user != 0'; |
| 191 | + } |
| 192 | + if ( $wgUser->useRCPatrol() && $hidePatrolled ) { |
| 193 | + $conds[] = 'rc_patrolled != 1'; |
| 194 | + } |
180 | 195 | |
181 | 196 | # Toggle watchlist content (all recent edits or just the latest) |
182 | 197 | if( $wgUser->getOption( 'extendwatchlist' )) { |
183 | | - $andLatest=''; |
184 | 198 | $limitWatchlist = intval( $wgUser->getOption( 'wllimit' ) ); |
185 | 199 | $usePage = false; |
186 | 200 | } else { |
187 | 201 | # Top log Ids for a page are not stored |
188 | | - $andLatest = 'rc_this_oldid=page_latest OR rc_type=' . RC_LOG; |
| 202 | + $conds[] = 'rc_this_oldid=page_latest OR rc_type=' . RC_LOG; |
189 | 203 | $limitWatchlist = 0; |
190 | 204 | $usePage = true; |
191 | 205 | } |
— | — | @@ -215,7 +229,6 @@ |
216 | 230 | |
217 | 231 | $tables = array( 'recentchanges', 'watchlist' ); |
218 | 232 | $fields = array( "{$recentchanges}.*" ); |
219 | | - $conds = array(); |
220 | 233 | $join_conds = array( |
221 | 234 | 'watchlist' => array('INNER JOIN',"wl_user='{$uid}' AND wl_namespace=rc_namespace AND wl_title=rc_title"), |
222 | 235 | ); |
— | — | @@ -226,15 +239,6 @@ |
227 | 240 | if( $limitWatchlist ) { |
228 | 241 | $options['LIMIT'] = $limitWatchlist; |
229 | 242 | } |
230 | | - if( $andcutoff ) $conds[] = $andcutoff; |
231 | | - if( $andLatest ) $conds[] = $andLatest; |
232 | | - if( $andHideOwn ) $conds[] = $andHideOwn; |
233 | | - if( $andHideBots ) $conds[] = $andHideBots; |
234 | | - if( $andHideMinor ) $conds[] = $andHideMinor; |
235 | | - if( $andHideLiu ) $conds[] = $andHideLiu; |
236 | | - if( $andHideAnons ) $conds[] = $andHideAnons; |
237 | | - if( $andHidePatrolled ) $conds[] = $andHidePatrolled; |
238 | | - if( $nameSpaceClause ) $conds[] = $nameSpaceClause; |
239 | 243 | |
240 | 244 | $rollbacker = $wgUser->isAllowed('rollback'); |
241 | 245 | if ( $usePage || $rollbacker ) { |