r88188 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r88187‎ | r88188 | r88189 >
Date:14:46, 15 May 2011
Author:btongminh
Status:ok
Tags:
Comment:
Per CR r75906, reintroduce ApiUpload::transformWarnings()
Modified paths:
  • /trunk/phase3/includes/api/ApiUpload.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiUpload.php
@@ -342,30 +342,34 @@
343343
344344 if ( !$this->mParams['ignorewarnings'] ) {
345345 $warnings = $this->mUpload->checkWarnings();
346 - if ( $warnings ) {
347 - // Add indices
348 - $this->getResult()->setIndexedTagName( $warnings, 'warning' );
 346+ }
 347+ return $this->transformWarnings( $warnings );
 348+ }
 349+
 350+ protected function transformWarnings( $warnings ) {
 351+ if ( $warnings ) {
 352+ // Add indices
 353+ $this->getResult()->setIndexedTagName( $warnings, 'warning' );
349354
350 - if ( isset( $warnings['duplicate'] ) ) {
351 - $dupes = array();
352 - foreach ( $warnings['duplicate'] as $dupe ) {
353 - $dupes[] = $dupe->getName();
354 - }
355 - $this->getResult()->setIndexedTagName( $dupes, 'duplicate' );
356 - $warnings['duplicate'] = $dupes;
 355+ if ( isset( $warnings['duplicate'] ) ) {
 356+ $dupes = array();
 357+ foreach ( $warnings['duplicate'] as $dupe ) {
 358+ $dupes[] = $dupe->getName();
357359 }
 360+ $this->getResult()->setIndexedTagName( $dupes, 'duplicate' );
 361+ $warnings['duplicate'] = $dupes;
 362+ }
358363
359 - if ( isset( $warnings['exists'] ) ) {
360 - $warning = $warnings['exists'];
361 - unset( $warnings['exists'] );
362 - $warnings[$warning['warning']] = $warning['file']->getName();
363 - }
 364+ if ( isset( $warnings['exists'] ) ) {
 365+ $warning = $warnings['exists'];
 366+ unset( $warnings['exists'] );
 367+ $warnings[$warning['warning']] = $warning['file']->getName();
364368 }
365369 }
366 -
367370 return $warnings;
368371 }
369372
 373+
370374 /**
371375 * Perform the actual upload. Returns a suitable result array on success;
372376 * dies on failure.

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r75906core changes for UploadWizard (merged from r73549 to HEAD in branches/uploadw...neilk04:32, 3 November 2010

Status & tagging log