Index: trunk/phase3/maintenance/language/messages.inc |
— | — | @@ -1441,11 +1441,6 @@ |
1442 | 1442 | 'importnosources', |
1443 | 1443 | 'importnofile', |
1444 | 1444 | 'importuploaderror', |
1445 | | - 'import-parse-failure', |
1446 | | - 'import-articlename', |
1447 | | - 'import-noarticle', |
1448 | | - 'import-nonewrevisions', |
1449 | | - 'xml-error-string', |
1450 | 1445 | ), |
1451 | 1446 | 'importlog' => array( |
1452 | 1447 | 'importlogpage', |
Index: trunk/phase3/includes/SpecialImport.php |
— | — | @@ -30,14 +30,12 @@ |
31 | 31 | global $wgImportTargetNamespace; |
32 | 32 | |
33 | 33 | $interwiki = false; |
34 | | - $articleName = ''; |
35 | 34 | $namespace = $wgImportTargetNamespace; |
36 | 35 | $frompage = ''; |
37 | 36 | $history = true; |
38 | 37 | |
39 | 38 | if( $wgRequest->wasPosted() && $wgRequest->getVal( 'action' ) == 'submit') { |
40 | 39 | $isUpload = false; |
41 | | - $articleName = $wgRequest->getText( 'articlename' ); |
42 | 40 | $namespace = $wgRequest->getIntOrNull( 'namespace' ); |
43 | 41 | |
44 | 42 | switch( $wgRequest->getVal( "source" ) ) { |
— | — | @@ -63,7 +61,7 @@ |
64 | 62 | } |
65 | 63 | |
66 | 64 | if( WikiError::isError( $source ) ) { |
67 | | - $wgOut->addWikiText( '<p class="error">' . wfMsg( "importfailed", wfEscapeWikiText( $source->getMessage() ) ) . '</p>' ); |
| 65 | + $wgOut->addWikiText( wfEscapeWikiText( $source->getMessage() ) ); |
68 | 66 | } else { |
69 | 67 | $wgOut->addWikiText( wfMsg( "importstart" ) ); |
70 | 68 | |
— | — | @@ -71,26 +69,19 @@ |
72 | 70 | if( !is_null( $namespace ) ) { |
73 | 71 | $importer->setTargetNamespace( $namespace ); |
74 | 72 | } |
75 | | - if( $articleName !== '' ) { |
76 | | - $importer->setTargetArticleName( $articleName ); |
77 | | - } |
78 | | - $reporter = new ImportReporter( $importer, $isUpload, $interwiki, $frompage ); |
| 73 | + $reporter = new ImportReporter( $importer, $isUpload, $interwiki ); |
79 | 74 | |
80 | 75 | $reporter->open(); |
81 | 76 | $result = $importer->doImport(); |
82 | | - $resultCount = $reporter->close(); |
| 77 | + $reporter->close(); |
83 | 78 | |
84 | 79 | if( WikiError::isError( $result ) ) { |
85 | | - # No source or XML parse error |
86 | | - $wgOut->addWikiText( '<p class="error">' . wfMsg( "importfailed", wfEscapeWikiText( $result->getMessage() ) ) . '</p>' ); |
87 | | - } elseif( WikiError::isError( $resultCount ) ) { |
88 | | - # Zero revisions |
89 | | - $wgOut->addWikiText( '<p class="error">' . wfMsg( "importfailed", wfEscapeWikiText( $resultCount->getMessage() ) ) . '</p>' ); |
| 80 | + $wgOut->addWikiText( wfMsg( "importfailed", |
| 81 | + wfEscapeWikiText( $result->getMessage() ) ) ); |
90 | 82 | } else { |
91 | 83 | # Success! |
92 | 84 | $wgOut->addWikiText( wfMsg( "importsuccess" ) ); |
93 | 85 | } |
94 | | - $wgOut->addWikiText( '<hr />' ); |
95 | 86 | } |
96 | 87 | } |
97 | 88 | |
— | — | @@ -98,17 +89,18 @@ |
99 | 90 | |
100 | 91 | if( $wgUser->isAllowed( 'importupload' ) ) { |
101 | 92 | $wgOut->addWikiText( wfMsg( "importtext" ) ); |
102 | | - $wgOut->addHTML( |
103 | | - Xml::openElement( 'fieldset' ). |
104 | | - Xml::element( 'legend', null, wfMsg( 'upload' ) ) . |
105 | | - Xml::openElement( 'form', array( 'enctype' => 'multipart/form-data', 'method' => 'post', 'action' => $action ) ) . |
106 | | - Xml::hidden( 'action', 'submit' ) . |
107 | | - Xml::hidden( 'source', 'upload' ) . |
108 | | - Xml::hidden( 'MAX_FILE_SIZE', '2000000' ) . |
109 | | - "<input type='file' name='xmlimport' value='' size='30' />" . // No Xml function for type=file? Todo? |
110 | | - Xml::submitButton( wfMsg( 'uploadbtn' ) ) . |
111 | | - Xml::closeElement( 'form' ) . |
112 | | - Xml::closeElement( 'fieldset' ) ); |
| 93 | + $wgOut->addHTML( " |
| 94 | +<fieldset> |
| 95 | + <legend>" . wfMsgHtml('upload') . "</legend> |
| 96 | + <form enctype='multipart/form-data' method='post' action=\"$action\"> |
| 97 | + <input type='hidden' name='action' value='submit' /> |
| 98 | + <input type='hidden' name='source' value='upload' /> |
| 99 | + <input type='hidden' name='MAX_FILE_SIZE' value='2000000' /> |
| 100 | + <input type='file' name='xmlimport' value='' size='30' /> |
| 101 | + <input type='submit' value=\"" . wfMsgHtml( "uploadbtn" ) . "\" /> |
| 102 | + </form> |
| 103 | +</fieldset> |
| 104 | +" ); |
113 | 105 | } else { |
114 | 106 | if( empty( $wgImportSources ) ) { |
115 | 107 | $wgOut->addWikiText( wfMsg( 'importnosources' ) ); |
— | — | @@ -116,57 +108,53 @@ |
117 | 109 | } |
118 | 110 | |
119 | 111 | if( !empty( $wgImportSources ) ) { |
120 | | - $wgOut->addHTML( |
121 | | - Xml::openElement( 'fieldset' ) . |
122 | | - Xml::element( 'legend', null, wfMsg( 'importinterwiki' ) ) . |
123 | | - Xml::openElement( 'form', array( 'method' => 'post', 'action' => $action ) ) . |
124 | | - wfMsgExt( 'import-interwiki-text', array( 'parse' ) ) . |
125 | | - Xml::hidden( 'action', 'submit' ) . |
126 | | - Xml::hidden( 'source', 'interwiki' ) . |
127 | | - Xml::openElement( 'table' ) . |
128 | | - "<tr> |
129 | | - <td>" . |
130 | | - Xml::openElement( 'select', array( 'name' => 'interwiki' ) ) ); |
| 112 | + $wgOut->addHTML( " |
| 113 | +<fieldset> |
| 114 | + <legend>" . wfMsgHtml('importinterwiki') . "</legend> |
| 115 | + <form method='post' action=\"$action\">" . |
| 116 | + $wgOut->parse( wfMsg( 'import-interwiki-text' ) ) . " |
| 117 | + <input type='hidden' name='action' value='submit' /> |
| 118 | + <input type='hidden' name='source' value='interwiki' /> |
| 119 | + <table> |
| 120 | + <tr> |
| 121 | + <td> |
| 122 | + <select name='interwiki'>" ); |
131 | 123 | foreach( $wgImportSources as $prefix ) { |
132 | 124 | $iw = htmlspecialchars( $prefix ); |
133 | 125 | $selected = ($interwiki === $prefix) ? ' selected="selected"' : ''; |
134 | | - $wgOut->addHTML( Xml::option( $iw, $iw, $selected ) ); |
| 126 | + $wgOut->addHTML( "<option value=\"$iw\"$selected>$iw</option>\n" ); |
135 | 127 | } |
136 | | - $wgOut->addHTML( |
137 | | - Xml::closeElement( 'select' ) . |
138 | | - "</td> |
| 128 | + $wgOut->addHTML( " |
| 129 | + </select> |
| 130 | + </td> |
139 | 131 | <td>" . |
140 | | - Xml::input( 'frompage', 50, $frompage ) . |
| 132 | + wfInput( 'frompage', 50, $frompage ) . |
141 | 133 | "</td> |
142 | 134 | </tr> |
143 | 135 | <tr> |
144 | 136 | <td></td> |
145 | 137 | <td>" . |
146 | | - Xml::checkLabel( wfMsg( 'import-interwiki-history' ), 'interwikiHistory', 'interwikiHistory', $history ) . |
| 138 | + wfCheckLabel( wfMsg( 'import-interwiki-history' ), |
| 139 | + 'interwikiHistory', 'interwikiHistory', $history ) . |
147 | 140 | "</td> |
148 | 141 | </tr> |
149 | 142 | <tr> |
150 | 143 | <td></td> |
151 | | - <td>" . |
152 | | - Xml::inputLabel( wfMsg( 'import-articlename' ), 'articlename', 'articlename', 50, $articleName ) . |
153 | | - "</td> |
| 144 | + <td> |
| 145 | + " . wfMsgHtml( 'import-interwiki-namespace' ) . " " . |
| 146 | + HTMLnamespaceselector( $namespace, '' ) . " |
| 147 | + </td> |
154 | 148 | </tr> |
155 | 149 | <tr> |
156 | 150 | <td></td> |
157 | 151 | <td>" . |
158 | | - Xml::label( wfMsg( 'import-interwiki-namespace' ), 'namespace' ) . |
159 | | - Xml::namespaceSelector( $namespace, '' ) . |
| 152 | + wfSubmitButton( wfMsg( 'import-interwiki-submit' ) ) . |
160 | 153 | "</td> |
161 | 154 | </tr> |
162 | | - <tr> |
163 | | - <td></td> |
164 | | - <td>" . |
165 | | - Xml::submitButton( wfMsg( 'import-interwiki-submit' ) ) . |
166 | | - "</td> |
167 | | - </tr>" . |
168 | | - Xml::closeElement( 'table' ). |
169 | | - Xml::closeElement( 'form' ) . |
170 | | - Xml::closeElement( 'fieldset' ) ); |
| 155 | + </table> |
| 156 | + </form> |
| 157 | +</fieldset> |
| 158 | +" ); |
171 | 159 | } |
172 | 160 | } |
173 | 161 | |
— | — | @@ -175,12 +163,11 @@ |
176 | 164 | * @addtogroup SpecialPage |
177 | 165 | */ |
178 | 166 | class ImportReporter { |
179 | | - function __construct( $importer, $upload, $interwiki, $frompage ) { |
| 167 | + function __construct( $importer, $upload, $interwiki ) { |
180 | 168 | $importer->setPageOutCallback( array( $this, 'reportPage' ) ); |
181 | 169 | $this->mPageCount = 0; |
182 | 170 | $this->mIsUpload = $upload; |
183 | 171 | $this->mInterwiki = $interwiki; |
184 | | - $this->mFrompage = $frompage; |
185 | 172 | } |
186 | 173 | |
187 | 174 | function open() { |
— | — | @@ -198,23 +185,20 @@ |
199 | 186 | $localCount = $wgLang->formatNum( $successCount ); |
200 | 187 | $contentCount = $wgContLang->formatNum( $successCount ); |
201 | 188 | |
202 | | - if( $successCount > 0 ) { |
203 | | - $wgOut->addHtml( "<li>" . $skin->makeKnownLinkObj( $title ) . |
204 | | - " " . |
205 | | - wfMsgExt( 'import-revision-count', array( 'parsemag', 'escape' ), $localCount ) . |
206 | | - "</li>\n" ); |
| 189 | + $wgOut->addHtml( "<li>" . $skin->makeKnownLinkObj( $title ) . |
| 190 | + " " . |
| 191 | + wfMsgExt( 'import-revision-count', array( 'parsemag', 'escape' ), $localCount ) . |
| 192 | + "</li>\n" ); |
207 | 193 | |
| 194 | + if( $successCount > 0 ) { |
208 | 195 | $log = new LogPage( 'import' ); |
209 | 196 | if( $this->mIsUpload ) { |
210 | 197 | $detail = wfMsgForContent( 'import-logentry-upload-detail', |
211 | 198 | $contentCount ); |
212 | 199 | $log->addEntry( 'upload', $title, $detail ); |
213 | 200 | } else { |
214 | | - // Show the source article name in log |
215 | | - $origin = $this->mFrompage != $origTitle->getPrefixedText() |
216 | | - ? $this->mFrompage |
217 | | - : $origTitle->getPrefixedText(); |
218 | | - $interwiki = '[[:' . $this->mInterwiki . ':' . $origin . ']]'; |
| 201 | + $interwiki = '[[:' . $this->mInterwiki . ':' . |
| 202 | + $origTitle->getPrefixedText() . ']]'; |
219 | 203 | $detail = wfMsgForContent( 'import-logentry-interwiki-detail', |
220 | 204 | $contentCount, $interwiki ); |
221 | 205 | $log->addEntry( 'interwiki', $title, $detail ); |
— | — | @@ -225,21 +209,15 @@ |
226 | 210 | $nullRevision = Revision::newNullRevision( |
227 | 211 | $dbw, $title->getArticleId(), $comment, true ); |
228 | 212 | $nullRevision->insertOn( $dbw ); |
229 | | - } else { |
230 | | - $wgOut->addHtml( '<li>' . wfMsgExt( 'import-nonewrevisions', array( 'parse', ) ) . '</li>' ); |
231 | 213 | } |
232 | | - |
233 | 214 | } |
234 | 215 | |
235 | 216 | function close() { |
236 | 217 | global $wgOut; |
237 | 218 | if( $this->mPageCount == 0 ) { |
238 | | - $wgOut->addHtml( "</ul>\n" ); |
239 | | - return new WikiErrorMsg( "importnopages" ); |
| 219 | + $wgOut->addHtml( "<li>" . wfMsgHtml( 'importnopages' ) . "</li>\n" ); |
240 | 220 | } |
241 | 221 | $wgOut->addHtml( "</ul>\n" ); |
242 | | - |
243 | | - return $this->mPageCount; |
244 | 222 | } |
245 | 223 | } |
246 | 224 | |
— | — | @@ -415,7 +393,6 @@ |
416 | 394 | var $mPageOutCallback = null; |
417 | 395 | var $mRevisionCallback = null; |
418 | 396 | var $mTargetNamespace = null; |
419 | | - var $mTargetArticleName = null; |
420 | 397 | var $lastfield; |
421 | 398 | |
422 | 399 | function WikiImporter( $source ) { |
— | — | @@ -448,7 +425,7 @@ |
449 | 426 | $chunk = $this->mSource->readChunk(); |
450 | 427 | if( !xml_parse( $parser, $chunk, $this->mSource->atEnd() ) ) { |
451 | 428 | wfDebug( "WikiImporter::doImport encountered XML parsing error\n" ); |
452 | | - return new WikiXmlError( $parser, wfMsgHtml( 'import-parse-failure' ), $chunk, $offset ); |
| 429 | + return new WikiXmlError( $parser, 'XML import parse failure', $chunk, $offset ); |
453 | 430 | } |
454 | 431 | $offset += strlen( $chunk ); |
455 | 432 | } while( $chunk !== false && !$this->mSource->atEnd() ); |
— | — | @@ -524,13 +501,6 @@ |
525 | 502 | } |
526 | 503 | |
527 | 504 | /** |
528 | | - * Set a target articlename to override the defaults |
529 | | - */ |
530 | | - function setTargetArticleName( $articleName ) { |
531 | | - $this->mTargetArticleName = $articleName; |
532 | | - } |
533 | | - |
534 | | - /** |
535 | 505 | * Default per-revision callback, performs the import. |
536 | 506 | * @param WikiRevision $revision |
537 | 507 | * @private |
— | — | @@ -707,11 +677,6 @@ |
708 | 678 | switch( $this->appendfield ) { |
709 | 679 | case "title": |
710 | 680 | $this->workTitle = $this->appenddata; |
711 | | - |
712 | | - if( $this->mTargetArticleName != '' ) { |
713 | | - // Import article with a different target article name |
714 | | - $this->workTitle = $this->mTargetArticleName; |
715 | | - } |
716 | 681 | $this->origTitle = Title::newFromText( $this->workTitle ); |
717 | 682 | if( !is_null( $this->mTargetNamespace ) && !is_null( $this->origTitle ) ) { |
718 | 683 | $this->pageTitle = Title::makeTitle( $this->mTargetNamespace, |
— | — | @@ -911,9 +876,6 @@ |
912 | 877 | } |
913 | 878 | |
914 | 879 | public static function newFromInterwiki( $interwiki, $page, $history=false ) { |
915 | | - if( $page == '' ) { |
916 | | - return new WikiErrorMsg( 'import-noarticle' ); |
917 | | - } |
918 | 880 | $link = Title::newFromText( "$interwiki:Special:Export/$page" ); |
919 | 881 | if( is_null( $link ) || $link->getInterwiki() == '' ) { |
920 | 882 | return new WikiErrorMsg( 'importbadinterwiki' ); |
Index: trunk/phase3/includes/WikiError.php |
— | — | @@ -101,7 +101,7 @@ |
102 | 102 | |
103 | 103 | /** @return string */ |
104 | 104 | function getMessage() { |
105 | | - return sprintf( wfMsgHtml( 'xml-error-string', '%s', '%d', '%d', '%d%s', '%s' ), |
| 105 | + return sprintf( '%s at line %d, col %d (byte %d%s): %s', |
106 | 106 | $this->mMessage, |
107 | 107 | $this->mLine, |
108 | 108 | $this->mColumn, |
Index: trunk/phase3/languages/messages/MessagesEn.php |
— | — | @@ -2158,16 +2158,11 @@ |
2159 | 2159 | 'importcantopen' => "Couldn't open import file", |
2160 | 2160 | 'importbadinterwiki' => 'Bad interwiki link', |
2161 | 2161 | 'importnotext' => 'Empty or no text', |
2162 | | -'importsuccess' => 'Import finished!', |
| 2162 | +'importsuccess' => 'Import succeeded!', |
2163 | 2163 | 'importhistoryconflict' => 'Conflicting history revision exists (may have imported this page before)', |
2164 | 2164 | 'importnosources' => 'No transwiki import sources have been defined and direct history uploads are disabled.', |
2165 | 2165 | 'importnofile' => 'No import file was uploaded.', |
2166 | 2166 | 'importuploaderror' => 'Upload of import file failed; perhaps the file is bigger than the allowed upload size.', |
2167 | | -'import-parse-failure' => 'XML import parse failure', |
2168 | | -'import-articlename' => 'New article name:', |
2169 | | -'import-noarticle' => 'No article to import!', |
2170 | | -'import-nonewrevisions' => 'All revisions were previously imported.', |
2171 | | -'xml-error-string' => '$1 at line $2, col $3 (byte $4): $5', |
2172 | 2167 | |
2173 | 2168 | # Import log |
2174 | 2169 | 'importlogpage' => 'Import log', |
Index: trunk/phase3/languages/messages/MessagesDe.php |
— | — | @@ -1726,24 +1726,19 @@ |
1727 | 1727 | 'import-interwiki-submit' => 'Import', |
1728 | 1728 | 'import-interwiki-namespace' => 'Importiere die Seite in den Namensraum:', |
1729 | 1729 | 'importtext' => 'Auf dieser Spezialseite können über [[{{ns:special}}:Export]] exportierte Seiten in dieses Wiki importiert werden.', |
1730 | | -'importstart' => 'Importiere Seite …', |
| 1730 | +'importstart' => 'Importiere Seiten …', |
1731 | 1731 | 'import-revision-count' => '– {{PLURAL:$1|1 Version|$1 Versionen}}', |
1732 | | -'importnopages' => 'Keine Seite zum Importieren vorhanden.', |
| 1732 | +'importnopages' => 'Keine Seiten zum Importieren vorhanden.', |
1733 | 1733 | 'importfailed' => 'Import fehlgeschlagen: $1', |
1734 | 1734 | 'importunknownsource' => 'Unbekannte Importquelle', |
1735 | 1735 | 'importcantopen' => 'Importdatei konnte nicht geöffnet werden', |
1736 | 1736 | 'importbadinterwiki' => 'Falscher Interwiki-Link', |
1737 | 1737 | 'importnotext' => 'Leer oder kein Text', |
1738 | | -'importsuccess' => 'Import abgeschlossen!', |
| 1738 | +'importsuccess' => 'Import erfolgreich!', |
1739 | 1739 | 'importhistoryconflict' => 'Es existieren bereits ältere Versionen, welche mit diesen kollidieren. Möglicherweise wurde die Seite bereits vorher importiert.', |
1740 | 1740 | 'importnosources' => 'Für den Transwiki-Import sind keine Quellen definiert. Das direkte Hochladen von Versionen ist gesperrt.', |
1741 | 1741 | 'importnofile' => 'Es ist keine Importdatei ausgewählt worden!', |
1742 | 1742 | 'importuploaderror' => 'Das Hochladen der Importdatei ist fehlgeschlagen. Vielleicht ist die Datei größer als erlaubt.', |
1743 | | -'import-parse-failure' => 'Fehler beim XML-Import:', |
1744 | | -'import-articlename' => 'Neuer Artikelname:', |
1745 | | -'import-noarticle' => 'Es wurde kein zu importierender Artikel angegeben!', |
1746 | | -'import-nonewrevisions' => 'Es sind keine neuen Versionen zum Import vorhanden, alle Versionen wurden bereits früher importiert.', |
1747 | | -'xml-error-string' => '$1 Zeile $2, Spalte $3, (Byte $4): $5' , |
1748 | 1743 | |
1749 | 1744 | # Import log |
1750 | 1745 | 'importlogpage' => 'Import-Logbuch', |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -152,8 +152,6 @@ |
153 | 153 | inline, as in most browsers |
154 | 154 | * Pass the user as an argument to 'isValidPassword' hook callbacks; see |
155 | 155 | docs/hooks.txt for more information |
156 | | -* (bug 6808) Allow import to different page name |
157 | | -* (bug 6436) Localization of Special:Import XML parser Error message(s). |
158 | 156 | |
159 | 157 | == Bugfixes since 1.10 == |
160 | 158 | |