jenkins-bot has submitted this change and it was merged.

Change subject: CategoryViewer: Do opportunistic category recounts for 
mismatched file counts, too
......................................................................


CategoryViewer: Do opportunistic category recounts for mismatched file counts, 
too

There are some categories on Commons that have no files, but are
recorded to have some, e.g. [1] appears to have 15 files [2]. We have
logic to fix these, but it wasn't being checked for file counts (only
pages and subcats).

[1] https://commons.wikimedia.org/wiki/Category:Police_of_Mexico,_D._F._vehicles
[2] 
https://commons.wikimedia.org/w/index.php?title=Category:Police_of_Mexico,_D._F._vehicles&action=info

Change-Id: If88fc15347eb592e957452884c2179d7c237bd2c
---
M includes/CategoryViewer.php
1 file changed, 6 insertions(+), 3 deletions(-)

Approvals:
  Brian Wolff: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/CategoryViewer.php b/includes/CategoryViewer.php
index b912603..f749003 100644
--- a/includes/CategoryViewer.php
+++ b/includes/CategoryViewer.php
@@ -387,6 +387,7 @@
                $r = '';
                $rescnt = count( $this->children );
                $dbcnt = $this->cat->getSubcatCount();
+               // This function should be called even if the result isn't 
used, it has side-effects
                $countmsg = $this->getCountMessage( $rescnt, $dbcnt, 'subcat' );
 
                if ( $rescnt > 0 ) {
@@ -417,6 +418,7 @@
                $dbcnt = $this->cat->getPageCount() - 
$this->cat->getSubcatCount()
                        - $this->cat->getFileCount();
                $rescnt = count( $this->articles );
+               // This function should be called even if the result isn't 
used, it has side-effects
                $countmsg = $this->getCountMessage( $rescnt, $dbcnt, 'article' 
);
 
                if ( $rescnt > 0 ) {
@@ -437,10 +439,11 @@
        function getImageSection() {
                $r = '';
                $rescnt = $this->showGallery ? $this->gallery->count() : count( 
$this->imgsNoGallery );
-               if ( $rescnt > 0 ) {
-                       $dbcnt = $this->cat->getFileCount();
-                       $countmsg = $this->getCountMessage( $rescnt, $dbcnt, 
'file' );
+               $dbcnt = $this->cat->getFileCount();
+               // This function should be called even if the result isn't 
used, it has side-effects
+               $countmsg = $this->getCountMessage( $rescnt, $dbcnt, 'file' );
 
+               if ( $rescnt > 0 ) {
                        $r .= "<div id=\"mw-category-media\">\n";
                        $r .= '<h2>' .
                                $this->msg(

-- 
To view, visit https://gerrit.wikimedia.org/r/273986
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: If88fc15347eb592e957452884c2179d7c237bd2c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Bartosz DziewoƄski <[email protected]>
Gerrit-Reviewer: Aaron Schulz <[email protected]>
Gerrit-Reviewer: Brian Wolff <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to