Umherirrender has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/189235

Change subject: Skip file count on Special:Statistics when no files and no 
upload
......................................................................

Skip file count on Special:Statistics when no files and no upload

There is no need to show the number of zero files on Special:Statistics
when it is not possible to upload files, but it is needed, when some
files already uploaded even if the upload is disabled later.

Change-Id: I4431166ebc8e952e5d926d874b56c743bebcbef1
---
M includes/specials/SpecialStatistics.php
1 file changed, 12 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/35/189235/1

diff --git a/includes/specials/SpecialStatistics.php 
b/includes/specials/SpecialStatistics.php
index 4429022..7f3682d 100644
--- a/includes/specials/SpecialStatistics.php
+++ b/includes/specials/SpecialStatistics.php
@@ -126,7 +126,7 @@
         * @return string
         */
        private function getPageStats() {
-               return Xml::openElement( 'tr' ) .
+               $pageStatsHtml = Xml::openElement( 'tr' ) .
                        Xml::tags( 'th', array( 'colspan' => '2' ), $this->msg( 
'statistics-header-pages' )->parse() ) .
                        Xml::closeElement( 'tr' ) .
                                $this->formatRow( Linker::linkKnown( 
SpecialPage::getTitleFor( 'Allpages' ),
@@ -136,11 +136,17 @@
                                $this->formatRow( $this->msg( 
'statistics-pages' )->parse(),
                                        $this->getLanguage()->formatNum( 
$this->total ),
                                        array( 'class' => 'mw-statistics-pages' 
),
-                                       'statistics-pages-desc' ) .
-                               $this->formatRow( Linker::linkKnown( 
SpecialPage::getTitleFor( 'MediaStatistics' ),
-                                       $this->msg( 'statistics-files' 
)->parse() ),
-                                       $this->getLanguage()->formatNum( 
$this->images ),
-                                       array( 'class' => 'mw-statistics-files' 
) );
+                                       'statistics-pages-desc' );
+
+               // Show the image row only, when there are files or upload is 
possible
+               if ( $this->images !== 0 || $this->getConfig()->get( 
'EnableUploads' ) ) {
+                       $pageStatsHtml .= $this->formatRow( Linker::linkKnown( 
SpecialPage::getTitleFor( 'MediaStatistics' ),
+                               $this->msg( 'statistics-files' )->parse() ),
+                               $this->getLanguage()->formatNum( $this->images 
),
+                               array( 'class' => 'mw-statistics-files' ) );
+               }
+
+               return $pageStatsHtml;
        }
 
        private function getEditStats() {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4431166ebc8e952e5d926d874b56c743bebcbef1
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Umherirrender <[email protected]>

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

Reply via email to