Mattflaschen has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/190128

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(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Flow 
refs/changes/28/190128/1

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: newchange
Gerrit-Change-Id: Ic1d88f27ff4a9ec8cdf021914672904b14874e5f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: Mattflaschen <[email protected]>

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

Reply via email to