r51292 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r51291‎ | r51292 | r51293 >
Date:16:39, 1 June 2009
Author:siebrand
Status:ok
Tags:
Comment:
(bug 19017) TOC level calculation error in an odd case. Patch by Brad Jorsch.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/parser/Parser.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/parser/Parser.php
@@ -3477,23 +3477,19 @@
34783478 elseif ( $level < $prevlevel && $toclevel > 1 ) {
34793479 # Decrease TOC level, find level to jump to
34803480
3481 - if ( $toclevel == 2 && $level <= $levelCount[1] ) {
3482 - # Can only go down to level 1
3483 - $toclevel = 1;
3484 - } else {
3485 - for ($i = $toclevel; $i > 0; $i--) {
3486 - if ( $levelCount[$i] == $level ) {
3487 - # Found last matching level
3488 - $toclevel = $i;
3489 - break;
3490 - }
3491 - elseif ( $levelCount[$i] < $level ) {
3492 - # Found first matching level below current level
3493 - $toclevel = $i + 1;
3494 - break;
3495 - }
 3481+ for ($i = $toclevel; $i > 0; $i--) {
 3482+ if ( $levelCount[$i] == $level ) {
 3483+ # Found last matching level
 3484+ $toclevel = $i;
 3485+ break;
34963486 }
 3487+ elseif ( $levelCount[$i] < $level ) {
 3488+ # Found first matching level below current level
 3489+ $toclevel = $i + 1;
 3490+ break;
 3491+ }
34973492 }
 3493+ if( $i == 0 ) $toclevel = 1;
34983494 if( $toclevel<$wgMaxTocLevel ) {
34993495 if($prevtoclevel < $wgMaxTocLevel) {
35003496 # Unindent only if the previous toc level was shown :p
Index: trunk/phase3/RELEASE-NOTES
@@ -180,6 +180,7 @@
181181 variable instead of using this to overrules the user language preference.
182182 * (bug 19014) If user had deletedhistory right, but not undeleted right, then
183183 show "view" instead of "view/restore" on logs.
 184+* (bug 19017) TOC level calculation error in an odd case
184185
185186 == API changes in 1.16 ==
186187

Status & tagging log