From 4bad1ed0880a41e9d71518f3b35daae7e838857a Mon Sep 17 00:00:00 2001 From: Aryeh Gregor Date: Fri, 13 Aug 2010 22:07:48 +0000 Subject: [PATCH] Fix extensions to work with category sort changes Three different extensions were copy-pasting all of CategoryPage::closeShowCategory() just to change which CategoryViewer descendant was used. I changed the base class to use a member variable for the CategoryViewer class, so this reduces code duplication too. I only tested this on CategoryTree; MetavidWiki is certainly still broken, from the looks of it (assumes $this->from is a string), but PeopleCategories might be okay. Hard to avoid breaking extensions with this sort of schema/index change. --- includes/CategoryPage.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/includes/CategoryPage.php b/includes/CategoryPage.php index dc90b04eb5..287efcf240 100644 --- a/includes/CategoryPage.php +++ b/includes/CategoryPage.php @@ -11,6 +11,9 @@ if ( !defined( 'MEDIAWIKI' ) ) /** */ class CategoryPage extends Article { + # Subclasses can change this to override the viewer class. + protected $mCategoryViewerClass = 'CategoryViewer'; + function view() { global $wgRequest, $wgUser; @@ -62,7 +65,7 @@ class CategoryPage extends Article { $until[$type] = isset( $_GET["{$type}until"] ) ? $_GET["{$type}until"] : null; } - $viewer = new CategoryViewer( $this->mTitle, $from, $until, $_GET ); + $viewer = new $this->mCategoryViewerClass( $this->mTitle, $from, $until, $_GET ); $wgOut->addHTML( $viewer->getHTML() ); } } -- 2.20.1