r103448 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r103447‎ | r103448 | r103449 >
Date:09:20, 17 November 2011
Author:ariel
Status:resolved (Comments)
Tags:
Comment:
if user id is 0 and username is actually an IP, write it as <ip>, not <username>
Modified paths:
  • /trunk/phase3/includes/Export.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Export.php
@@ -618,7 +618,13 @@
619619 $out .= " " . Xml::elementClean( 'username', null, strval( $text ) ) . "\n";
620620 $out .= " " . Xml::element( 'id', null, strval( $id ) ) . "\n";
621621 } else {
622 - $out .= " " . Xml::elementClean( 'ip', null, strval( $text ) ) . "\n";
 622+ if ( IP::isValid( $text ) ) {
 623+ $out .= " " . Xml::elementClean( 'ip', null, strval( $text ) ) . "\n";
 624+ }
 625+ else {
 626+ $out .= " " . Xml::elementClean( 'username', null, strval( $text ) ) . "\n";
 627+ $out .= " " . Xml::element( 'id', null, strval( $id ) ) . "\n";
 628+ }
623629 }
624630 $out .= " </contributor>\n";
625631 return $out;

Follow-up revisions

RevisionCommit summaryAuthorDate
r103582followup to r103448, tighten up codeariel09:08, 18 November 2011

Comments

#Comment by Platonides (talk | contribs)   16:15, 17 November 2011

Why not change the above if

if ( $id ) {

to

if ( $id || !IP::isValid( $text ) ) {

?

#Comment by ArielGlenn (talk | contribs)   09:09, 18 November 2011

Sold! (Because originally I had not written out the id in the else, I re-added it at the last minute.) Did so in r103582.

Status & tagging log