Page MenuHomePhabricator

allow CategoryPageView to set $mCategoryViewerClass
Closed, ResolvedPublic

Description

The $mCategoryViewerClass variable defined in CategoryPage is protected, and therefore that prevent the hook CategoryPageView to override the viewer class without extending CategoryPage and rewrite the function CategoryPage::view() where this hook is raised.

An example of current implementation is this extension :
https://phabricator.wikimedia.org/diffusion/SVN/browse/trunk/extensions/PeopleCategories/PeopleCategories.php
https://phabricator.wikimedia.org/diffusion/SVN/browse/trunk/extensions/PeopleCategories/PeopleCategories.body.php

We can see that the MediaWiki source code evolved since this extension has been written. But we force the author of the extension to duplicate the code while implementing PeopleCategoriesPage. If $mCategoryViewerClass was public, he could do this:

$wgHooks['CategoryPageView'][] = 'efPeopleCategories';

function efPeopleCategories( &$categoryArticle ) {
	$categoryArticle->mCategoryViewerClass = 'PeopleCategoriesViewer';
}

... and implement only PeopleCategoriesViewer.

Revisions and Commits

Event Timeline

Louperivois added a revision: Restricted Differential Revision.May 31 2017, 4:17 AM

Change 357899 had a related patch set uploaded (by Louperivois; owner: Louperivois):
[mediawiki/core@master] FIX T166483 : Allow CategoryPageView to set $mCategoryViewerClass

https://gerrit.wikimedia.org/r/357899

Change 357899 had a related patch set uploaded (by Louperivois; owner: Louperivois):
[mediawiki/core@master] Allow CategoryPageView to set $mCategoryViewerClass

https://gerrit.wikimedia.org/r/357899

Change 357899 merged by jenkins-bot:
[mediawiki/core@master] Allow CategoryPageView to set $mCategoryViewerClass

https://gerrit.wikimedia.org/r/357899

matmarex assigned this task to Louperivois.
matmarex removed a project: Patch-For-Review.