r15097 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r15096‎ | r15097 | r15098 >
Date:19:32, 27 June 2006
Author:brion
Status:old
Tags:
Comment:
* (bug 2481) List imported pages during Special:Import
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/SpecialImport.php (modified) (history)
  • /trunk/phase3/languages/Messages.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/SpecialImport.php
@@ -55,8 +55,12 @@
5656 if( WikiError::isError( $source ) ) {
5757 $wgOut->addWikiText( wfEscapeWikiText( $source->getMessage() ) );
5858 } else {
 59+ $wgOut->addWikiText( wfMsg( "importstart" ) );
5960 $importer = new WikiImporter( $source );
 61+ $reporter = new ImportReporter( $importer );
 62+ $reporter->open();
6063 $result = $importer->doImport();
 64+ $reporter->close();
6165 if( WikiError::isError( $result ) ) {
6266 $wgOut->addWikiText( wfMsg( "importfailed",
6367 wfEscapeWikiText( $result->getMessage() ) ) );
@@ -113,6 +117,37 @@
114118 }
115119
116120 /**
 121+ * Reporting callback
 122+ */
 123+class ImportReporter {
 124+ function __construct( $importer ) {
 125+ $importer->setPageCallback( array( $this, 'reportPage' ) );
 126+ $this->pageCount = 0;
 127+ }
 128+
 129+ function open() {
 130+ global $wgOut;
 131+ $wgOut->addHtml( "<ul>\n" );
 132+ }
 133+
 134+ function reportPage( $pageName ) {
 135+ global $wgOut, $wgUser;
 136+ $skin = $wgUser->getSkin();
 137+ $title = Title::newFromText( $pageName );
 138+ $wgOut->addHtml( "<li>" . $skin->makeKnownLinkObj( $title ) . "</li>\n" );
 139+ $this->pageCount++;
 140+ }
 141+
 142+ function close() {
 143+ global $wgOut;
 144+ if( $this->pageCount == 0 ) {
 145+ $wgOut->addHtml( "<li>" . wfMsgHtml( 'importnopages' ) . "</li>\n" );
 146+ }
 147+ $wgOut->addHtml( "</ul>\n" );
 148+ }
 149+}
 150+
 151+/**
117152 *
118153 * @package MediaWiki
119154 * @subpackage SpecialPage
Index: trunk/phase3/RELEASE-NOTES
@@ -574,6 +574,7 @@
575575 * Update to Piedmontese localization (pms)
576576 * dumpBackup can optionally compress via dbzip2
577577 * (bug 2483) Run link updates on change via XML import
 578+* (bug 2481) List imported pages during Special:Import
578579
579580
580581 == Compatibility ==
Index: trunk/phase3/languages/Messages.php
@@ -1458,6 +1458,8 @@
14591459 'import' => 'Import pages',
14601460 'importinterwiki' => 'Transwiki import',
14611461 'importtext' => 'Please export the file from the source wiki using the Special:Export utility, save it to your disk and upload it here.',
 1462+'importstart' => "Importing pages...",
 1463+'importnopages' => "No pages to import.",
14621464 'importfailed' => "Import failed: $1",
14631465 'importnotext' => 'Empty or no text',
14641466 'importsuccess' => 'Import succeeded!',