jenkins-bot has submitted this change and it was merged.
Change subject: Import: Fix loop off-by-one error, doc, and make readable
......................................................................
Import: Fix loop off-by-one error, doc, and make readable
Change-Id: Ic1d88f27ff4a9ec8cdf021914672904b14874e5f
---
M includes/Import/Converter.php
1 file changed, 4 insertions(+), 3 deletions(-)
Approvals:
Matthias Mullie: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/Import/Converter.php b/includes/Import/Converter.php
index 9b3c719..b24bf2d 100644
--- a/includes/Import/Converter.php
+++ b/includes/Import/Converter.php
@@ -297,7 +297,7 @@
* It will iterate through the formats looking for an existing format.
If no
* formats are currently in use the first format will be returned with
n=1.
* If a format is currently in used we will look for the first unused
page
- * between n=2 and n=20.
+ * >= to n=1 and <= to n=20.
*
* @param Title $source
* @param string[] $formats
@@ -324,13 +324,14 @@
// assumes this creates a valid title
return Title::newFromText( sprintf( $formats[0], $text,
$n ) );
}
- for ( ++$n; $n < 20; ++$n ) {
+
+ for ( $n = 2; $n <= 20; ++$n ) {
$title = Title::newFromText( sprintf( $format, $text,
$n ) );
if ( $title && !$titleRepo->exists( $title ) ) {
return $title;
}
}
- throw new ImportException( "All titles 1 through 20 exist for
format: $format" );
+ throw new ImportException( "All titles 1 through 20 (inclusive)
exist for format: $format" );
}
}
--
To view, visit https://gerrit.wikimedia.org/r/190128
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ic1d88f27ff4a9ec8cdf021914672904b14874e5f
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: Mattflaschen <[email protected]>
Gerrit-Reviewer: EBernhardson <[email protected]>
Gerrit-Reviewer: Matthias Mullie <[email protected]>
Gerrit-Reviewer: SG <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits