Index: trunk/extensions/DataTransfer/specials/DT_ImportCSV.php |
— | — | @@ -72,13 +72,27 @@ |
73 | 73 | |
74 | 74 | if ( $wgRequest->getCheck( 'import_file' ) ) { |
75 | 75 | $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(); |
79 | 87 | } else { |
| 88 | + $source = $uploadResult; |
| 89 | + } |
| 90 | + |
| 91 | + if ( !is_null( $uploadError ) ) { |
| 92 | + $text .= $uploadError; |
| 93 | + } else { |
80 | 94 | $encoding = $wgRequest->getVal( 'encoding' ); |
81 | 95 | $pages = array(); |
82 | | - $error_msg = self::getCSVData( $source->value->mHandle, $encoding, $pages ); |
| 96 | + $error_msg = self::getCSVData( $source->mHandle, $encoding, $pages ); |
83 | 97 | if ( ! is_null( $error_msg ) ) { |
84 | 98 | $text .= $error_msg; |
85 | 99 | } else { |