r96886 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r96885‎ | r96886 | r96887 >
Date:19:09, 12 September 2011
Author:brion
Status:ok (Comments)
Tags:
Comment:
* (bug 30865) Fix regression breaking category pages when there's no local page content

Output in CategoryViewer::getHtml() was trying to close an outside div, then re-open another one (with different dir/lang settings). Switched it to instead open a child div with the desired properties, so there's no danger of surprise inconsistency.
Modified paths:
  • /trunk/phase3/includes/CategoryPage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/CategoryPage.php
@@ -143,7 +143,7 @@
144144 * @return string HTML output
145145 */
146146 public function getHTML() {
147 - global $wgOut, $wgCategoryMagicGallery;
 147+ global $wgOut, $wgCategoryMagicGallery, $wgLang;
148148 wfProfileIn( __METHOD__ );
149149
150150 $this->showGallery = $wgCategoryMagicGallery && !$wgOut->mNoGallery;
@@ -172,14 +172,14 @@
173173 // Give a proper message if category is empty
174174 if ( $r == '' ) {
175175 $r = wfMsgExt( 'category-empty', array( 'parse' ) );
176 - } else {
177 - $pageLang = $this->title->getPageLanguage();
178 - $langAttribs = array( 'lang' => $pageLang->getCode(), 'dir' => $pageLang->getDir() );
179 - # close the previous div, show the headings in user language,
180 - # then open a new div with the page content language again
181 - $r = '</div>' . $r . Html::openElement( 'div', $langAttribs );
182176 }
183177
 178+ $pageLang = $this->title->getPageLanguage();
 179+ $langAttribs = array( 'lang' => $wgLang->getCode(), 'dir' => $wgLang->getDir() );
 180+ # close the previous div, show the headings in user language,
 181+ # then open a new div with the page content language again
 182+ $r = Html::openElement( 'div', $langAttribs ) . $r . '</div>';
 183+
184184 wfProfileOut( __METHOD__ );
185185 return $r;
186186 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r96888MFT r96886: backport to fix bug 30865 on 1.18...brion19:25, 12 September 2011

Comments

#Comment by SPQRobin (talk | contribs)   20:15, 12 September 2011

Marking as OK as it seems to display correctly as far as I tested.

Status & tagging log