r81998 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r81997‎ | r81998 | r81999 >
Date:22:07, 11 February 2011
Author:aaron
Status:deferred
Tags:
Comment:
Reflect various schema changes
Modified paths:
  • /trunk/extensions/FlaggedRevs/specialpages/PendingChanges_body.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/specialpages/UnreviewedPages_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/specialpages/PendingChanges_body.php
@@ -341,8 +341,7 @@
342342 $fields[] = 'fp_quality AS quality';
343343 $fields[] = 'fp_pending_since AS pending_since';
344344 $conds[] = 'page_id = fp_page_id';
345 - # Overconstrain rev_page to force PK use
346 - $conds[] = 'rev_page = page_id AND rev_id = fp_stable';
 345+ $conds[] = 'rev_id = fp_stable'; // PK
347346 $conds[] = 'fp_pending_since IS NOT NULL';
348347 $useIndex = array( 'flaggedpages' => 'fp_pending_since', 'page' => 'PRIMARY' );
349348 # Filter by pages configured to be stable
@@ -352,7 +351,7 @@
353352 $conds['fpc_override'] = 1;
354353 }
355354 # Filter by category
356 - if ( $this->category ) {
 355+ if ( $this->category != '' ) {
357356 $tables[] = 'categorylinks';
358357 $conds[] = 'cl_from = fp_page_id';
359358 $conds['cl_to'] = $this->category;
@@ -366,11 +365,10 @@
367366 $fields[] = 'fpp_quality AS quality';
368367 $fields[] = 'fpp_pending_since AS pending_since';
369368 $conds[] = 'page_id = fpp_page_id';
370 - # Overconstrain rev_page to force PK use
371 - $conds[] = 'rev_page = page_id AND rev_id = fpp_rev_id';
 369+ $conds[] = 'rev_id = fpp_rev_id'; // PK
372370 $conds[] = 'fpp_pending_since IS NOT NULL';
373 - $useIndex = array( 'flaggedpage_pending' => 'fpp_quality_pending',
374 - 'page' => 'PRIMARY' );
 371+ $useIndex = array(
 372+ 'flaggedpage_pending' => 'fpp_quality_pending', 'page' => 'PRIMARY' );
375373 # Filter by review level
376374 $conds['fpp_quality'] = $this->level;
377375 # Filter by pages configured to be stable
@@ -402,8 +400,7 @@
403401 }
404402 # Filter by bytes changed
405403 if ( $this->size !== null && $this->size >= 0 ) {
406 - # Get absolute difference for comparison. ABS(x-y)
407 - # is broken due to mysql unsigned int design.
 404+ # Note: ABS(x-y) is broken due to mysql unsigned int design.
408405 $conds[] = 'GREATEST(page_len,rev_len)-LEAST(page_len,rev_len) <= ' .
409406 intval( $this->size );
410407 }
Index: trunk/extensions/FlaggedRevs/specialpages/UnreviewedPages_body.php
@@ -147,7 +147,7 @@
148148 }
149149
150150 /**
151 - * Get number of users watching a page. Max is 5.
 151+ * Get number of users watching a page.
152152 * @param Title $title
153153 * @return int
154154 */
@@ -267,15 +267,15 @@
268268 $conds['page_is_redirect'] = 0;
269269 }
270270 # Filter by category
271 - if ( $this->category ) {
 271+ if ( $this->category != '' ) {
272272 $tables = array( 'categorylinks', 'page', 'flaggedpages', 'revision' );
273273 $fields[] = 'cl_sortkey';
274274 $conds['cl_to'] = $this->category;
275275 $conds[] = 'cl_from = page_id';
276276 # Note: single NS always specified
277 - if( $this->namespace == NS_FILE ) {
 277+ if ( $this->namespace == NS_FILE ) {
278278 $conds['cl_type'] = 'file';
279 - } elseif( $this->namespace == NS_CATEGORY ) {
 279+ } elseif ( $this->namespace == NS_CATEGORY ) {
280280 $conds['cl_type'] = 'subcat';
281281 } else {
282282 $conds['cl_type'] = 'page';
@@ -311,7 +311,7 @@
312312 # the proper cache for this level.
313313 if ( $this->level == 1 ) {
314314 $conds['qc_type'] = 'fr_unreviewedpages_q';
315 - $conds[] = "fp_page_id IS NULL OR fp_quality < {$this->level}";
 315+ $conds[] = "fp_page_id IS NULL OR fp_quality < 1";
316316 } else {
317317 $conds['qc_type'] = 'fr_unreviewedpages';
318318 $conds[] = 'fp_page_id IS NULL';
@@ -324,10 +324,18 @@
325325 }
326326 $this->mIndexField = 'qc_value'; // page_id
327327 # Filter by category
328 - if ( $this->category ) {
 328+ if ( $this->category != '' ) {
329329 $tables = array( 'page', 'categorylinks', 'querycache', 'flaggedpages', 'revision' );
330330 $conds['cl_to'] = $this->category;
331331 $conds[] = 'cl_from = qc_value'; // page_id
 332+ # Note: single NS always specified
 333+ if ( $this->namespace == NS_FILE ) {
 334+ $conds['cl_type'] = 'file';
 335+ } elseif ( $this->namespace == NS_CATEGORY ) {
 336+ $conds['cl_type'] = 'subcat';
 337+ } else {
 338+ $conds['cl_type'] = 'page';
 339+ }
332340 } else {
333341 $tables = array( 'page', 'querycache', 'flaggedpages', 'revision' );
334342 }

Status & tagging log