(bug 13693) Categories sometimes claim to have a negative number of members. Just...
authorAryeh Gregor <simetrical@users.mediawiki.org>
Thu, 15 May 2008 17:04:34 +0000 (17:04 +0000)
committerAryeh Gregor <simetrical@users.mediawiki.org>
Thu, 15 May 2008 17:04:34 +0000 (17:04 +0000)
RELEASE-NOTES
includes/Category.php

index 16065f8..2c05a83 100644 (file)
@@ -274,6 +274,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * (bug 14063) Power search form missing <label> for redirects check
 * (bug 14111) Similar filename warning links now lead to correct page
 * (bug 14082) Fix for complex text input vs AJAX suggestions on some browsers
+* (bug 13693) Categories sometimes claim to have a negative number of members
 
 
 === API changes in 1.13 ===
index 37127d5..15e56b1 100644 (file)
@@ -237,6 +237,15 @@ class Category extends CategoryListBase {
         */
        protected function initialize() {
                parent::initialize();
+
+               # (bug 13683) If the count is negative, then 1) it's obviously wrong
+               # and should not be kept, and 2) we *probably* don't have to scan many
+               # rows to obtain the correct figure, so let's risk a one-time recount.
+               if( $this->mPages[0] < 0 || $this->mSubcats[0] < 0 ||
+               $this->mFiles[0] < 0 ) {
+                       $this->refreshCounts();
+               }
+
                if( count( $this->mNames ) != 1 || count( $this->mIDs ) != 1 ) {
                        return false;
                }