Jdlrobson has uploaded a new change for review. https://gerrit.wikimedia.org/r/261202
Change subject: Allow other skins to be the mobile skin ...................................................................... Allow other skins to be the mobile skin e.g. http://localhost:8888/w/index.php/Headings?useskin=vector&useformat=mobile This also allows a hidden user preference `mobileskin` that allows users to override their mobile skin. Change-Id: I7c000165c61a4bd2094f23b6ffd96335f7f7818f --- M includes/MobileFrontend.hooks.php 1 file changed, 24 insertions(+), 9 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend refs/changes/02/261202/1 diff --git a/includes/MobileFrontend.hooks.php b/includes/MobileFrontend.hooks.php index e409282..7758161 100644 --- a/includes/MobileFrontend.hooks.php +++ b/includes/MobileFrontend.hooks.php @@ -103,16 +103,31 @@ // log whether user is using beta/stable $mobileContext->logMobileMode(); - $skinName = $mobileContext->getMFConfig()->get( 'MFDefaultSkinClass' ); - $betaSkinName = $skinName . 'Beta'; - // Force beta for test mode to sure all modules can run - $name = $context->getTitle()->getDBkey(); - $inTestMode = - $name === SpecialPage::getTitleFor( 'JavaScriptTest', 'qunit' )->getDBkey(); - if ( $mobileContext->isBetaGroupMember() && class_exists( $betaSkinName ) ) { - $skinName = $betaSkinName; + // Allow overriding of skin by useskin e.g. useskin=vector&useformat=mobile + if ( $context->getRequest()->getVal( 'useskin' ) ) { + $userSkin = $mobileContext->getUser()->getOption( 'mobileskin' ); + $userSkin = $mobileContext->getRequest()->getVal( 'useskin', $userSkin ); + + // Normalize the key in case the user is passing gibberish + // or has old preferences (bug 69566). + $normalized = Skin::normalizeKey( $userSkin ); + + // Skin::normalizeKey will also validate it, so + // this won't throw an exception + $factory = SkinFactory::getDefaultInstance(); + $skin = $factory->makeSkin( $normalized ); + } else { + $skinName = $mobileContext->getMFConfig()->get( 'MFDefaultSkinClass' ); + $betaSkinName = $skinName . 'Beta'; + // Force beta for test mode to sure all modules can run + $name = $context->getTitle()->getDBkey(); + $inTestMode = + $name === SpecialPage::getTitleFor( 'JavaScriptTest', 'qunit' )->getDBkey(); + if ( $mobileContext->isBetaGroupMember() && class_exists( $betaSkinName ) ) { + $skinName = $betaSkinName; + } + $skin = new $skinName( $context ); } - $skin = new $skinName( $context ); return false; } -- To view, visit https://gerrit.wikimedia.org/r/261202 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I7c000165c61a4bd2094f23b6ffd96335f7f7818f Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/MobileFrontend Gerrit-Branch: master Gerrit-Owner: Jdlrobson <[email protected]> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
