Page MenuHomePhabricator

Provide a hook for other PageViewService than WikimediaPageViewService
Closed, DeclinedPublic

Description

As a third-party wiki administrator, I hope to use Google analytics as a backend for PageViewInfo.
But it is hard to implement and maintain subclasses implement PageViewService interface for arbitrary analytics services.
Providing a hook for giving a chance to replace WikimediaPageViewService initialization is a much effortless solution to Wikimedia, I think.

Event Timeline

Change 695669 had a related patch set uploaded (by Lens0021; author: Lens0021):

[mediawiki/extensions/PageViewInfo@master] Add a new hook for replacing WikimediaPageView

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

There are already a hook and functions for more general use in the core. Huge thanks to legoktm!

https://wm-bot.wmflabs.org/libera_logs/%23mediawiki/20210621.txt
[07:46:15] <legoktm>	 lens0021: IIRC the intention was that you can redefine the 'PageViewService' service
[07:47:30] <legoktm>	 in the MediaWikiServices hook you can call $services->redefineService('PageViewService', .... )
[07:48:05] <legoktm>	 ok, that's not the right function
[07:48:14] <legoktm>	 but https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/extensions/AbsenteeLandlord/+/refs/heads/master/AbsenteeLandlord.class.php#21 is an example for another service
[07:49:01] <legoktm>	 https://gerrit.wikimedia.org/g/mediawiki/libs/Services/+/9432d29e9c4670970975c1413a8d7735d349ae52/src/ServiceContainer.php#253 oh, redefineService does exist
[07:49:22] <legoktm>	 addServiceManipulator looks more like if you want to wrap the existing service

Change 695669 abandoned by Lens0021:

[mediawiki/extensions/PageViewInfo@master] Introduce a new hook for replacing WikimediaPageView Service with subclass of PageViewService

Reason:

There are already a hook and functions for more general use in the core.

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