Merge "Use ImageGallery directly in SpecialUpload::getDupeWarning()"
authorSiebrand <siebrand@wikimedia.org>
Wed, 29 Aug 2012 13:40:22 +0000 (13:40 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 29 Aug 2012 13:40:22 +0000 (13:40 +0000)
includes/specials/SpecialUpload.php

index d1a9b16..43ea345 100644 (file)
@@ -702,21 +702,18 @@ class SpecialUpload extends SpecialPage {
         * @return string
         */
        public static function getDupeWarning( $dupes ) {
-               global $wgOut;
-               if( $dupes ) {
-                       $msg = '<gallery>';
-                       foreach( $dupes as $file ) {
-                               $title = $file->getTitle();
-                               $msg .= $title->getPrefixedText() .
-                                       '|' . $title->getText() . "\n";
-                       }
-                       $msg .= '</gallery>';
-                       return '<li>' .
-                               wfMessage( 'file-exists-duplicate' )->numParams( count( $dupes ) )->parse() .
-                               $wgOut->parse( $msg ) . "</li>\n";
-               } else {
+               if ( !$dupes ) {
                        return '';
                }
+
+               $gallery = new ImageGallery;
+               $gallery->setShowBytes( false );
+               foreach( $dupes as $file ) {
+                       $gallery->add( $file->getTitle() );
+               }
+               return '<li>' .
+                       wfMessage( 'file-exists-duplicate' )->numParams( count( $dupes ) )->parse() .
+                       $gallery->toHtml() . "</li>\n";
        }
 
 }