Page MenuHomePhabricator

Remove EnterMobileMode hook in MobileFrontend and deprecate BeforePageDisplayMobile
Open, LowPublic

Description

https://gerrit.wikimedia.org/r/c/operations/mediawiki-config/+/966798 removed the sole caller of EnterMobileMode (as far as codesearch can tell).

Historically there were a couple non-CentralAuth-related uses (rOMWC355a2710231f: Direct mobile banner requests to mobile site for CentralNotice, rEULSfd885d988112: Initial support for webfonts in MobileFrontend for UniversalLanguageSelector, the never merged rOMWCaec20bade127: Log more Navigation Timing events on mobile for NavigationTiming) but those didn't survive.

The hook was added in rEMFRc5228db3de98: New hook EnterMobileMode to "inform other extensions that we're going to have a mobile page view"; that use case makes sense, but the hook doesn't serve it well, because it's called at an unpredictable point in time, leading to issues like rOMWCf8ad56ce4d8a: Better hack for T49647. I think it would be better to just expose MobileContext::shouldDisplayMobileViewInternal() and internalize setForceMobileView(), which only has a single caller.

Most extensions these days are using:

$isMobileView = ExtensionRegistry::getInstance()->isLoaded( 'MobileFrontend' ) &&
			$services->getService( 'MobileFrontend.Context' )->shouldDisplayMobileView();
if ( $isMobileView ) {
  ..
}

TODO

  • Remove EnterMobileMode
  • Mark BeforePageDisplayMobile as soft deprecated.
  • Update Wikistories and Wikidata
  • Hard deprecate BeforePageDisplayMobile
	"DeprecatedHooks": {
		"GetMobileUrl": {
			"deprecatedVersion": "1.42",
			"component": "MobileFrontend"
		},
		"BeforePageDisplayMobile": {
			"deprecatedVersion": "1.43",
			"component": "MobileFrontend"
		}
	},
  • Wait one deploy cycle
  • Remove.

Event Timeline

Jdlrobson renamed this task from Consider deprecating EnterMobileMode hook in MobileFrontend to Remove EnterMobileMode hook in MobileFrontend and deprecate BeforePageDisplayMobile.May 24 2024, 4:21 PM
Jdlrobson updated the task description. (Show Details)

Change #1035799 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/extensions/MobileFrontend@master] Remove EnterMobileMode hook, deprecate BeforePageDisplayMobile hook

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

Change #1035799 merged by jenkins-bot:

[mediawiki/extensions/MobileFrontend@master] Remove EnterMobileMode hook, deprecate BeforePageDisplayMobile hook

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