* dumpBackup can optionally compress via dbzip2
* (bug 2483) Run link updates on change via XML import
* (bug 2481) List imported pages during Special:Import
+* (bug 2482) Log and RC entries for Special:Import events
== Compatibility ==
* an action, which is a specific kind of event that can exist in that
* log type.
*/
-$wgLogTypes = array( '', 'block', 'protect', 'rights', 'delete', 'upload', 'move' );
+$wgLogTypes = array( '',
+ 'block',
+ 'protect',
+ 'rights',
+ 'delete',
+ 'upload',
+ 'move',
+ 'import' );
/**
* Lists the message key string for each log type. The localized messages
'rights' => 'rightslog',
'delete' => 'dellogpage',
'upload' => 'uploadlogpage',
- 'move' => 'movelogpage' );
+ 'move' => 'movelogpage',
+ 'import' => 'importlogpage' );
/**
* Lists the message key string for descriptive text to be shown at the
'rights' => 'rightslogtext',
'delete' => 'dellogpagetext',
'upload' => 'uploadlogpagetext',
- 'move' => 'movelogpagetext' );
+ 'move' => 'movelogpagetext',
+ 'import' => 'importlogpagetext', );
/**
* Lists the message key string for formatting individual events of each
'upload/upload' => 'uploadedimage',
'upload/revert' => 'uploadedimage',
'move/move' => '1movedto2',
- 'move/move_redir' => '1movedto2_redir' );
+ 'move/move_redir' => '1movedto2_redir',
+ 'import/upload' => 'import-logentry-upload',
+ 'import/interwiki' => 'import-logentry-interwiki' );
/**
* Experimental preview feature to fetch rendered text
###
if( $wgRequest->wasPosted() && $wgRequest->getVal( 'action' ) == 'submit') {
+ $isUpload = false;
+ $interwiki = false;
+
switch( $wgRequest->getVal( "source" ) ) {
case "upload":
+ $isUpload = true;
if( $wgUser->isAllowed( 'importupload' ) ) {
$source = ImportStreamSource::newFromUpload( "xmlimport" );
} else {
}
break;
case "interwiki":
+ $interwiki = $wgRequest->getVal( "interwiki" );
$source = ImportStreamSource::newFromInterwiki(
- $wgRequest->getVal( "interwiki" ),
+ $interwiki,
$wgRequest->getText( "frompage" ) );
break;
default:
$wgOut->addWikiText( wfEscapeWikiText( $source->getMessage() ) );
} else {
$wgOut->addWikiText( wfMsg( "importstart" ) );
+
$importer = new WikiImporter( $source );
- $reporter = new ImportReporter( $importer );
+ $reporter = new ImportReporter( $importer, $isUpload, $interwiki );
+
$reporter->open();
$result = $importer->doImport();
$reporter->close();
+
if( WikiError::isError( $result ) ) {
$wgOut->addWikiText( wfMsg( "importfailed",
wfEscapeWikiText( $result->getMessage() ) ) );
* Reporting callback
*/
class ImportReporter {
- function __construct( $importer ) {
+ function __construct( $importer, $upload, $interwiki ) {
$importer->setPageCallback( array( $this, 'reportPage' ) );
- $this->pageCount = 0;
+ $this->mPageCount = 0;
+ $this->mIsUpload = $upload;
+ $this->mInterwiki = $interwiki;
}
function open() {
global $wgOut, $wgUser;
$skin = $wgUser->getSkin();
$title = Title::newFromText( $pageName );
+ $this->mPageCount++;
+
$wgOut->addHtml( "<li>" . $skin->makeKnownLinkObj( $title ) . "</li>\n" );
- $this->pageCount++;
+
+ $log = new LogPage( 'import' );
+ if( $this->mIsUpload ) {
+ $log->addEntry( 'upload', $title, '' );
+ } else {
+ $interwiki = '[[:' . $this->mInterwiki . ':' .
+ $title->getPrefixedText() . ']]';
+ $log->addEntry( 'interwiki', $title,
+ wfMsg( 'import-logentry-interwiki-source', $interwiki ) );
+ }
}
function close() {
global $wgOut;
- if( $this->pageCount == 0 ) {
+ if( $this->mPageCount == 0 ) {
$wgOut->addHtml( "<li>" . wfMsgHtml( 'importnopages' ) . "</li>\n" );
}
$wgOut->addHtml( "</ul>\n" );
'importnofile' => 'No import file was uploaded.',
'importuploaderror' => 'Upload of import file failed; perhaps the file is bigger than the allowed upload size.',
+# import log
+'importlogpage' => 'Import log',
+'importlogpagetext' => 'Administrative imports of pages with edit history from other wikis.',
+'import-logentry-upload' => 'imported $1 by file upload',
+'import-logentry-interwiki' => 'transwikied $1',
+'import-logentry-interwiki-source' => 'from $1',
+
+
# Keyboard access keys for power users
'accesskey-search' => 'f',
'accesskey-minoredit' => 'i',