From 65670fbce357d666978e9df000b735606a48d8fe Mon Sep 17 00:00:00 2001 From: jdlrobson Date: Wed, 16 Aug 2017 14:32:30 -0500 Subject: [PATCH] Do not assume MobileFrontend special pages exist If they don't exist attempts to use them will throw errors. This will only happen if MobileFrontend is not installed Change-Id: Iee674011bbd59d79914a144d1738b912eceea6b1 --- includes/skins/SkinMinerva.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/includes/skins/SkinMinerva.php b/includes/skins/SkinMinerva.php index 558b56034..850d14e0e 100644 --- a/includes/skins/SkinMinerva.php +++ b/includes/skins/SkinMinerva.php @@ -629,6 +629,7 @@ class SkinMinerva extends SkinTemplate implements ICustomizableSkin { // Nearby link (if supported) if ( + SpecialPageFactory::exists( 'Nearby' ) && $config->get( 'MFNearby' ) && ( $config->get( 'MFNearbyEndpoint' ) || class_exists( 'GeoData\GeoData' ) ) ) { @@ -738,11 +739,18 @@ class SkinMinerva extends SkinTemplate implements ICustomizableSkin { $this->getLanguage()->userTime( $timestamp, $user ) )->parse(); } + + if ( SpecialPageFactory::exists( 'History' ) ) { + $historyUrl = SpecialPage::getTitleFor( 'History', $title )->getLocalURL(); + } else { + $historyUrl = $title->getLocalURL( [ 'action' => 'history' ] ); + } + $edit = $mp->getLatestEdit(); $link = [ // Use $edit['timestamp'] (Unix format) instead of $timestamp (MW format) 'data-timestamp' => $isMainPage ? '' : $edit['timestamp'], - 'href' => SpecialPage::getTitleFor( 'History', $title )->getLocalURL(), + 'href' => $historyUrl, 'text' => $lastModified, 'data-user-name' => $edit['name'], 'data-user-gender' => $edit['gender'], @@ -864,7 +872,9 @@ class SkinMinerva extends SkinTemplate implements ICustomizableSkin { */ protected function prepareMenuButton( BaseTemplate $tpl ) { // menu button - $url = SpecialPage::getTitleFor( 'MobileMenu' )->getLocalUrl(); + $url = SpecialPageFactory::exists( 'MobileMenu' ) ? + SpecialPage::getTitleFor( 'MobileMenu' )->getLocalUrl() : '#'; + $tpl->set( 'menuButton', Html::element( 'a', [ 'title' => $this->msg( 'mobile-frontend-main-menu-button-tooltip' ),