jenkins-bot has submitted this change and it was merged.

Change subject: Import: Properly handle deleted usernames in XML dumps
......................................................................


Import: Properly handle deleted usernames in XML dumps

Fixed username being not shown at all when contributor is deleted
Fixed text not being shown when contributor is deleted

Bug: T121338
Change-Id: I981c326f61735ace1d1fba35428bfc25d127b544
---
M includes/Import.php
1 file changed, 6 insertions(+), 2 deletions(-)

Approvals:
  TTO: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/Import.php b/includes/Import.php
index ee1cab5..0999931 100644
--- a/includes/Import.php
+++ b/includes/Import.php
@@ -861,9 +861,10 @@
                }
                if ( isset( $revisionInfo['contributor']['ip'] ) ) {
                        $revision->setUserIP( 
$revisionInfo['contributor']['ip'] );
-               }
-               if ( isset( $revisionInfo['contributor']['username'] ) ) {
+               } elseif ( isset( $revisionInfo['contributor']['username'] ) ) {
                        $revision->setUserName( 
$revisionInfo['contributor']['username'] );
+               } else {
+                       $revision->setUserName( 'Unknown user' );
                }
                $revision->setNoUpdates( $this->mNoUpdates );
 
@@ -981,6 +982,9 @@
                $fields = array( 'id', 'ip', 'username' );
                $info = array();
 
+               if ( $this->reader->isEmptyElement ) {
+                       return $info;
+               }
                while ( $this->reader->read() ) {
                        if ( $this->reader->nodeType == XMLReader::END_ELEMENT 
&&
                                        $this->reader->localName == 
'contributor' ) {

-- 
To view, visit https://gerrit.wikimedia.org/r/260349
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I981c326f61735ace1d1fba35428bfc25d127b544
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Georggi199 <[email protected]>
Gerrit-Reviewer: TTO <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to