r78399 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r78398‎ | r78399 | r78400 >
Date:20:58, 14 December 2010
Author:yaron
Status:deferred
Tags:
Comment:
Re-added compatibility for MW 1.16 and earlier, removed by ialex in r77801
Modified paths:
  • /trunk/extensions/DataTransfer/specials/DT_ImportCSV.php (modified) (history)

Diff [purge]

Index: trunk/extensions/DataTransfer/specials/DT_ImportCSV.php
@@ -72,13 +72,27 @@
7373
7474 if ( $wgRequest->getCheck( 'import_file' ) ) {
7575 $text = DTUtils::printImportingMessage();
76 - $source = ImportStreamSource::newFromUpload( "file_name" );
77 - if ( !$source->isOK() ) {
78 - $text .= $wgOut->parse( $source->getWikiText() );
 76+ $uploadResult = ImportStreamSource::newFromUpload( "file_name" );
 77+ // handling changed in MW 1.17
 78+ $uploadError = null;
 79+ if ( $uploadResult instanceof Status ) {
 80+ if ( $uploadResult->isOK() ) {
 81+ $source = $uploadResult->value;
 82+ } else {
 83+ $uploadError = $wgOut->parse( $uploadResult->getWikiText() );
 84+ }
 85+ } elseif ( $uploadResult instanceof WikiErrorMsg ) {
 86+ $uploadError = $uploadResult->getMessage();
7987 } else {
 88+ $source = $uploadResult;
 89+ }
 90+
 91+ if ( !is_null( $uploadError ) ) {
 92+ $text .= $uploadError;
 93+ } else {
8094 $encoding = $wgRequest->getVal( 'encoding' );
8195 $pages = array();
82 - $error_msg = self::getCSVData( $source->value->mHandle, $encoding, $pages );
 96+ $error_msg = self::getCSVData( $source->mHandle, $encoding, $pages );
8397 if ( ! is_null( $error_msg ) ) {
8498 $text .= $error_msg;
8599 } else {

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r77801Follow-up r77800: fix extensions using static methods from ImportSourceStream...ialex14:31, 5 December 2010

Status & tagging log