http://www.mediawiki.org/wiki/Special:Code/MediaWiki/88188

Revision: 88188
Author:   btongminh
Date:     2011-05-15 14:46:13 +0000 (Sun, 15 May 2011)
Log Message:
-----------
Per CR r75906, reintroduce ApiUpload::transformWarnings()

Modified Paths:
--------------
    trunk/phase3/includes/api/ApiUpload.php

Modified: trunk/phase3/includes/api/ApiUpload.php
===================================================================
--- trunk/phase3/includes/api/ApiUpload.php     2011-05-15 14:32:49 UTC (rev 
88187)
+++ trunk/phase3/includes/api/ApiUpload.php     2011-05-15 14:46:13 UTC (rev 
88188)
@@ -342,30 +342,34 @@
 
                if ( !$this->mParams['ignorewarnings'] ) {
                        $warnings = $this->mUpload->checkWarnings();
-                       if ( $warnings ) {
-                               // Add indices
-                               $this->getResult()->setIndexedTagName( 
$warnings, 'warning' );
+               }
+               return $this->transformWarnings( $warnings );
+       }
+                       
+       protected function transformWarnings( $warnings ) {
+               if ( $warnings ) {
+                       // Add indices
+                       $this->getResult()->setIndexedTagName( $warnings, 
'warning' );
 
-                               if ( isset( $warnings['duplicate'] ) ) {
-                                       $dupes = array();
-                                       foreach ( $warnings['duplicate'] as 
$dupe ) {
-                                               $dupes[] = $dupe->getName();
-                                       }
-                                       $this->getResult()->setIndexedTagName( 
$dupes, 'duplicate' );
-                                       $warnings['duplicate'] = $dupes;
+                       if ( isset( $warnings['duplicate'] ) ) {
+                               $dupes = array();
+                               foreach ( $warnings['duplicate'] as $dupe ) {
+                                       $dupes[] = $dupe->getName();
                                }
+                               $this->getResult()->setIndexedTagName( $dupes, 
'duplicate' );
+                               $warnings['duplicate'] = $dupes;
+                       }
 
-                               if ( isset( $warnings['exists'] ) ) {
-                                       $warning = $warnings['exists'];
-                                       unset( $warnings['exists'] );
-                                       $warnings[$warning['warning']] = 
$warning['file']->getName();
-                               }
+                       if ( isset( $warnings['exists'] ) ) {
+                               $warning = $warnings['exists'];
+                               unset( $warnings['exists'] );
+                               $warnings[$warning['warning']] = 
$warning['file']->getName();
                        }
                }
-
                return $warnings;
        }
 
+
        /**
         * Perform the actual upload. Returns a suitable result array on 
success;
         * dies on failure.


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

Reply via email to