* (bug 30865) Fix regression breaking category pages when there's no local page content
authorBrion Vibber <brion@users.mediawiki.org>
Mon, 12 Sep 2011 19:09:51 +0000 (19:09 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Mon, 12 Sep 2011 19:09:51 +0000 (19:09 +0000)
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.

includes/CategoryPage.php

index bb08cf5..c833886 100644 (file)
@@ -143,7 +143,7 @@ class CategoryViewer {
         * @return string HTML output
         */
        public function getHTML() {
-               global $wgOut, $wgCategoryMagicGallery;
+               global $wgOut, $wgCategoryMagicGallery, $wgLang;
                wfProfileIn( __METHOD__ );
 
                $this->showGallery = $wgCategoryMagicGallery && !$wgOut->mNoGallery;
@@ -172,14 +172,14 @@ class CategoryViewer {
                // Give a proper message if category is empty
                if ( $r == '' ) {
                        $r = wfMsgExt( 'category-empty', array( 'parse' ) );
-               } else {
-                       $pageLang = $this->title->getPageLanguage();
-                       $langAttribs = array( 'lang' => $pageLang->getCode(), 'dir' => $pageLang->getDir() );
-                       # close the previous div, show the headings in user language,
-                       # then open a new div with the page content language again
-                       $r = '</div>' . $r . Html::openElement( 'div', $langAttribs );
                }
 
+               $pageLang = $this->title->getPageLanguage();
+               $langAttribs = array( 'lang' => $wgLang->getCode(), 'dir' => $wgLang->getDir() );
+               # close the previous div, show the headings in user language,
+               # then open a new div with the page content language again
+               $r = Html::openElement( 'div', $langAttribs ) . $r . '</div>';
+
                wfProfileOut( __METHOD__ );
                return $r;
        }