* (bug 2481) List imported pages during Special:Import
authorBrion Vibber <brion@users.mediawiki.org>
Tue, 27 Jun 2006 19:32:32 +0000 (19:32 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Tue, 27 Jun 2006 19:32:32 +0000 (19:32 +0000)
RELEASE-NOTES
includes/SpecialImport.php
languages/Messages.php

index 21053b6..fce55fe 100644 (file)
@@ -574,6 +574,7 @@ Some default configuration options have changed:
 * Update to Piedmontese localization (pms)
 * dumpBackup can optionally compress via dbzip2
 * (bug 2483) Run link updates on change via XML import
+* (bug 2481) List imported pages during Special:Import
 
 
 == Compatibility ==
index 37d6e5d..f19e0f4 100644 (file)
@@ -55,8 +55,12 @@ function wfSpecialImport( $page = '' ) {
                if( WikiError::isError( $source ) ) {
                        $wgOut->addWikiText( wfEscapeWikiText( $source->getMessage() ) );
                } else {
+                       $wgOut->addWikiText( wfMsg( "importstart" ) );
                        $importer = new WikiImporter( $source );
+                       $reporter = new ImportReporter( $importer );
+                       $reporter->open();
                        $result = $importer->doImport();
+                       $reporter->close();
                        if( WikiError::isError( $result ) ) {
                                $wgOut->addWikiText( wfMsg( "importfailed",
                                        wfEscapeWikiText( $result->getMessage() ) ) );
@@ -112,6 +116,37 @@ function wfSpecialImport( $page = '' ) {
        }
 }
 
+/**
+ * Reporting callback
+ */
+class ImportReporter {
+       function __construct( $importer ) {
+               $importer->setPageCallback( array( $this, 'reportPage' ) );
+               $this->pageCount = 0;
+       }
+       
+       function open() {
+               global $wgOut;
+               $wgOut->addHtml( "<ul>\n" );
+       }
+       
+       function reportPage( $pageName ) {
+               global $wgOut, $wgUser;
+               $skin = $wgUser->getSkin();
+               $title = Title::newFromText( $pageName );
+               $wgOut->addHtml( "<li>" . $skin->makeKnownLinkObj( $title ) . "</li>\n" );
+               $this->pageCount++;
+       }
+       
+       function close() {
+               global $wgOut;
+               if( $this->pageCount == 0 ) {
+                       $wgOut->addHtml( "<li>" . wfMsgHtml( 'importnopages' ) . "</li>\n" );
+               }
+               $wgOut->addHtml( "</ul>\n" );
+       }
+}
+
 /**
  *
  * @package MediaWiki
index a8db0f2..dd12c83 100644 (file)
@@ -1458,6 +1458,8 @@ In the latter case you can also use a link, e.g. [[{{ns:Special}}:Export/{{int:m
 'import'       => 'Import pages',
 'importinterwiki' => 'Transwiki import',
 'importtext'   => 'Please export the file from the source wiki using the Special:Export utility, save it to your disk and upload it here.',
+'importstart'  => "Importing pages...",
+'importnopages'        => "No pages to import.",
 'importfailed' => "Import failed: $1",
 'importnotext' => 'Empty or no text',
 'importsuccess'        => 'Import succeeded!',