http://www.mediawiki.org/wiki/Special:Code/MediaWiki/71902

Revision: 71902
Author:   simetrical
Date:     2010-08-29 21:21:57 +0000 (Sun, 29 Aug 2010)

Log Message:
-----------
Fix category count when category table out of sync

This should fix a regression from my category sort work, caused by not
accounting for the the fact that $this->from and $this->until were
changed to arrays.  Wrong counts for the number of pages in the category
might have been displayed in some cases.

Modified Paths:
--------------
    trunk/phase3/includes/CategoryPage.php

Modified: trunk/phase3/includes/CategoryPage.php
===================================================================
--- trunk/phase3/includes/CategoryPage.php      2010-08-29 21:18:49 UTC (rev 
71901)
+++ trunk/phase3/includes/CategoryPage.php      2010-08-29 21:21:57 UTC (rev 
71902)
@@ -585,12 +585,21 @@
                $totalrescnt = count( $this->articles ) + count( 
$this->children ) +
                        ( $this->showGallery ? $this->gallery->count() : 0 );
 
-               if ( $dbcnt == $rescnt || ( ( $totalrescnt == $this->limit || 
$this->from
-                       || $this->until ) && $dbcnt > $rescnt ) )
+               # Check if there's a "from" or "until" for anything
+               $fromOrUntil = false;
+               foreach ( array( 'page', 'subcat', 'file' ) as $type ) {
+                       if ( $this->from[$type] !== null || $this->until[$type] 
!== null ) {
+                               $fromOrUntil = true;
+                               break;
+                       }
+               }
+
+               if ( $dbcnt == $rescnt || ( ( $totalrescnt == $this->limit || 
$fromOrUntil )
+                       && $dbcnt > $rescnt ) )
                {
                        # Case 1: seems sane.
                        $totalcnt = $dbcnt;
-               } elseif ( $totalrescnt < $this->limit && !$this->from && 
!$this->until ) {
+               } elseif ( $totalrescnt < $this->limit && !$fromOrUntil ) {
                        # Case 2: not sane, but salvageable.  Use the number of 
results.
                        # Since there are fewer than 200, we can also take this 
opportunity
                        # to refresh the incorrect category table entry -- 
which should be



_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to