r80433 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r80432‎ | r80433 | r80434 >
Date:02:27, 17 January 2011
Author:bawolff
Status:ok
Tags:
Comment:
(follow-up r70415) Fixes the function that determines if category counts are correct to consider each
section independantly. Previously, it also partially considered the total of all 3 sections, since
before they were all paged as one unit. Now we page them independantly, so they should be independant.

As an aside, this (when combined with r80432) fixes bug 18663 (__NOGALLERY__ used to cause mediawiki
to think the cat members counts were wrong).
Modified paths:
  • /trunk/phase3/includes/CategoryPage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/CategoryPage.php
@@ -593,8 +593,8 @@
594594
595595 /**
596596 * What to do if the category table conflicts with the number of results
597 - * returned? This function says what. It works the same whether the
598 - * things being counted are articles, subcategories, or files.
 597+ * returned? This function says what. Each type is considered independantly
 598+ * of the other types.
599599 *
600600 * Note for grepping: uses the messages category-article-count,
601601 * category-article-count-limited, category-subcat-count,
@@ -617,24 +617,28 @@
618618 # than $this->limit and there's no offset. In this case we still
619619 # know the right figure.
620620 # 3) We have no idea.
621 - $totalrescnt = count( $this->articles ) + count( $this->children ) +
622 - ( $this->showGallery ? $this->gallery->count() : count( $this->imgsNoGallery ) );
623621
624622 # Check if there's a "from" or "until" for anything
 623+
 624+ // This is a little ugly, but we seem to use different names
 625+ // for the paging types then for the messages.
 626+ if ( $type === 'article' ) {
 627+ $pagingType = 'page';
 628+ } else {
 629+ $pagingType = $type;
 630+ }
 631+
625632 $fromOrUntil = false;
626 - foreach ( array( 'page', 'subcat', 'file' ) as $t ) {
627 - if ( $this->from[$t] !== null || $this->until[$t] !== null ) {
628 - $fromOrUntil = true;
629 - break;
630 - }
 633+ if ( $this->from[$pagingType] !== null || $this->until[$pagingType] !== null ) {
 634+ $fromOrUntil = true;
631635 }
632636
633 - if ( $dbcnt == $rescnt || ( ( $totalrescnt == $this->limit || $fromOrUntil )
 637+ if ( $dbcnt == $rescnt || ( ( $rescnt == $this->limit || $fromOrUntil )
634638 && $dbcnt > $rescnt ) )
635639 {
636640 # Case 1: seems sane.
637641 $totalcnt = $dbcnt;
638 - } elseif ( $totalrescnt < $this->limit && !$fromOrUntil ) {
 642+ } elseif ( $rescnt < $this->limit && !$fromOrUntil ) {
639643 # Case 2: not sane, but salvageable. Use the number of results.
640644 # Since there are fewer than 200, we can also take this opportunity
641645 # to refresh the incorrect category table entry -- which should be

Follow-up revisions

RevisionCommit summaryAuthorDate
r80545Fix typo in r80433catrope01:07, 19 January 2011
r805501.17: MFT r80106, r80137, r80138, r80205, r80210, r80222, r80223, r80231, r80...catrope02:09, 19 January 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r70415Enable new category sort by default...simetrical20:50, 3 August 2010
r80432(bug 26737; follow-up r70415) Make new category stuff play nice with __NOGALL...bawolff01:16, 17 January 2011

Status & tagging log