MarkAHershberger has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/374045 )
Change subject: Accomodate dump files that don't come directly from
dumpBackup.php
......................................................................
Accomodate dump files that don't come directly from dumpBackup.php
Bug: T174257
Change-Id: I581d29b37b2b0030838563e247a635b0defe3bbd
---
M includes/import/WikiImporter.php
M languages/i18n/en.json
2 files changed, 22 insertions(+), 5 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/45/374045/1
diff --git a/includes/import/WikiImporter.php b/includes/import/WikiImporter.php
index 2099709..b69dc92 100644
--- a/includes/import/WikiImporter.php
+++ b/includes/import/WikiImporter.php
@@ -996,14 +996,24 @@
$text = isset( $uploadInfo['text'] ) ? $uploadInfo['text'] : '';
$revision->setTitle( $pageInfo['_title'] );
- $revision->setID( $pageInfo['id'] );
- $revision->setTimestamp( $uploadInfo['timestamp'] );
+ if ( isset( $pageInfo['id'] ) ) {
+ $revision->setID( $pageInfo['id'] );
+ }
+ if ( isset( $uploadInfo['timestamp'] ) ) {
+ $revision->setTimestamp( $uploadInfo['timestamp'] );
+ }
$revision->setText( $text );
+ if ( !isset( $uploadInfo['filename'] ) ) {
+ $this->notice( 'import-error-need-filename',
$pageInfo['_title'] );
+ $uploadInfo['filename'] =
$pageInfo['_title']->getDBKey();
+ }
$revision->setFilename( $uploadInfo['filename'] );
if ( isset( $uploadInfo['archivename'] ) ) {
$revision->setArchiveName( $uploadInfo['archivename'] );
}
- $revision->setSrc( $uploadInfo['src'] );
+ if ( isset( $uploadInfo['src'] ) ) {
+ $revision->setSrc( $uploadInfo['src'] );
+ }
if ( isset( $uploadInfo['fileSrc'] ) ) {
$revision->setFileSrc( $uploadInfo['fileSrc'],
!empty( $uploadInfo['isTempSrc'] ) );
@@ -1011,14 +1021,20 @@
if ( isset( $uploadInfo['sha1base36'] ) ) {
$revision->setSha1Base36( $uploadInfo['sha1base36'] );
}
- $revision->setSize( intval( $uploadInfo['size'] ) );
- $revision->setComment( $uploadInfo['comment'] );
+ if ( isset( $uploadInfo['size'] ) ) {
+ $revision->setSize( intval( $uploadInfo['size'] ) );
+ }
+ if ( isset( $uploadInfo['comment'] ) ) {
+ $revision->setComment( $uploadInfo['comment'] );
+ }
if ( isset( $uploadInfo['contributor']['ip'] ) ) {
$revision->setUserIP( $uploadInfo['contributor']['ip']
);
}
if ( isset( $uploadInfo['contributor']['username'] ) ) {
$revision->setUsername(
$uploadInfo['contributor']['username'] );
+ } else {
+ $revision->setUsername( __CLASS__ );
}
$revision->setNoUpdates( $this->mNoUpdates );
diff --git a/languages/i18n/en.json b/languages/i18n/en.json
index a44b3cf..96c0952 100644
--- a/languages/i18n/en.json
+++ b/languages/i18n/en.json
@@ -2765,6 +2765,7 @@
"import-error-invalid": "Page \"$1\" was not imported because the name
to which it would be imported is invalid on this wiki.",
"import-error-unserialize": "Revision $2 of page \"$1\" could not be
unserialized. The revision was reported to use content model $3 serialized as
$4.",
"import-error-bad-location": "Revision $2 using content model $3 cannot
be stored on \"$1\" on this wiki, since that model is not supported on that
page.",
+ "import-error-need-filename": "No filename supplied for $1, using
title.",
"import-options-wrong": "Wrong {{PLURAL:$2|option|options}}:
<nowiki>$1</nowiki>",
"import-rootpage-invalid": "Given root page is an invalid title.",
"import-rootpage-nosubpage": "Namespace \"$1\" of the root page does
not allow subpages.",
--
To view, visit https://gerrit.wikimedia.org/r/374045
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I581d29b37b2b0030838563e247a635b0defe3bbd
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: MarkAHershberger <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits