From d8a8410a8d0026830c89d1f9825db42728b8625b Mon Sep 17 00:00:00 2001 From: jdlrobson Date: Thu, 3 Jan 2019 15:08:49 -0800 Subject: [PATCH] Hygiene: Simplify Nearby menu item registration The Special:Nearby page is only available if wgMFNearby is enabled so the first 2 checks are identical. If the page is enabled, we should be able to assume the sysop knows what they are doing and avoid all these unnecessary checks. It seems foolish to also check the existence of Geodata or a NearbyEndpoint Additional change: * Don't use deprecated SpecialPageFactory. Use the service instead. Change-Id: I3a4b8fa55fc7f29c90f7173d1d973d5f4f759a6b --- includes/skins/SkinMinerva.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/includes/skins/SkinMinerva.php b/includes/skins/SkinMinerva.php index aa45c47dd..e2cd954a4 100644 --- a/includes/skins/SkinMinerva.php +++ b/includes/skins/SkinMinerva.php @@ -639,6 +639,7 @@ class SkinMinerva extends SkinTemplate { protected function getDiscoveryTools() { $config = $this->getConfig(); $menu = new MenuBuilder(); + $factory = MediaWikiServices::getInstance()->getSpecialPageFactory(); // Home link $menu->insert( 'home' ) @@ -662,11 +663,7 @@ class SkinMinerva extends SkinTemplate { ); // Nearby link (if supported) - if ( - SpecialPageFactory::exists( 'Nearby' ) && - $config->get( 'MFNearby' ) && - ( $config->get( 'MFNearbyEndpoint' ) || class_exists( 'GeoData\GeoData' ) ) - ) { + if ( $factory->exists( 'Nearby' ) ) { $menu->insert( 'nearby', $isJSOnly = true ) ->addComponent( $this->msg( 'mobile-frontend-main-menu-nearby' )->escaped(),