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.
/**
*/
class CategoryPage extends Article {
+ # Subclasses can change this to override the viewer class.
+ protected $mCategoryViewerClass = 'CategoryViewer';
+
function view() {
global $wgRequest, $wgUser;
$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() );
}
}