Jdlrobson has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/403062 )
Change subject: Remove Special:MobileOptions/Languages ...................................................................... Remove Special:MobileOptions/Languages This was added back in 2012 In the old version of the language overlay when a language did not exist we linked to this page. We don't do that anymore since the new language overlay we launched in August 2016. It's not linked to anywhere in the UI. Should probably remove as it caused me a big surprise to not only see it existed but to see I wrote the code haha Change-Id: I9c7cca88c4f3df42f2ced93b72011f18d911acce --- M i18n/en.json M i18n/qqq.json M includes/specials/SpecialMobileOptions.php 3 files changed, 3 insertions(+), 83 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend refs/changes/62/403062/1 diff --git a/i18n/en.json b/i18n/en.json index d946136..bd0c5bb 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -201,7 +201,6 @@ "mobile-frontend-settings-tagline": "Reading preferences", "mobile-frontend-settings-beta": "Beta", "mobile-frontend-settings-site-description": "{{SITENAME}} is available in $1 {{PLURAL:$1|language|languages}}. All available versions are listed below", - "mobile-frontend-settings-site-header": "{{SITENAME}} Languages", "mobile-frontend-settings-save": "Settings were saved successfully.", "mobile-frontend-talk-fullpage": "Read as wiki page", "mobile-frontend-talk-add-overlay-content-placeholder": "What is on your mind?", diff --git a/i18n/qqq.json b/i18n/qqq.json index ab92dfc..7229faf 100644 --- a/i18n/qqq.json +++ b/i18n/qqq.json @@ -202,7 +202,6 @@ "mobile-frontend-settings-tagline": "Tagline for Special:MobileOptions - will show under heading", "mobile-frontend-settings-beta": "Text for beta on settings page.\n{{Identical|Beta}}", "mobile-frontend-settings-site-description": "Shown on [[Special:MobileOptions]]. Parameters:\n* $1 - the number of other language versions for this wiki", - "mobile-frontend-settings-site-header": "Heading for the Special:MobileOptions/Language page - only visible to non JavaScript users", "mobile-frontend-settings-save": "Notification which shows to user when settings are saved.", "mobile-frontend-talk-fullpage": "Used as label for link to the talk page (Talk:ArticleName) in Talk Overlay.", "mobile-frontend-talk-add-overlay-content-placeholder": "Placeholder text to prompt user to add content to talk page content", diff --git a/includes/specials/SpecialMobileOptions.php b/includes/specials/SpecialMobileOptions.php index ebb9364..2019570 100644 --- a/includes/specials/SpecialMobileOptions.php +++ b/includes/specials/SpecialMobileOptions.php @@ -8,11 +8,6 @@ private $returnToTitle; /** @var boolean $hasDesktopVersion Whether this special page has a desktop version or not */ protected $hasDesktopVersion = true; - /** @var array $options Used in the execute() function as a map of subpages to - functions that are executed when the request method is defined. */ - private $options = [ - 'Language' => [ 'get' => 'chooseLanguage' ], - ]; /** * Construct function @@ -44,24 +39,11 @@ $this->setHeaders(); $context->setForceMobileView( true ); $context->setContentTransformations( false ); - // check, if the subpage has a registered function, that needs to be executed - if ( isset( $this->options[$par] ) ) { - $option = $this->options[$par]; - // select the correct function for the given request method (post, get) - if ( $this->getRequest()->wasPosted() && isset( $option['post'] ) ) { - $func = $option['post']; - } else { - $func = $option['get']; - } - // run the function - $this->$func(); + if ( $this->getRequest()->wasPosted() ) { + $this->submitSettingsForm(); } else { - if ( $this->getRequest()->wasPosted() ) { - $this->submitSettingsForm(); - } else { - $this->addSettingsForm(); - } + $this->addSettingsForm(); } } @@ -143,59 +125,6 @@ } /** - * Get a list of languages available for this project - * @return string parsed Html - */ - private function getSiteSelector() { - $selector = ''; - $count = 0; - $language = $this->getLanguage(); - $interwikiLookup = \MediaWiki\MediaWikiServices::getInstance()->getInterwikiLookup(); - foreach ( $interwikiLookup->getAllPrefixes( true ) as $interwiki ) { - $code = $interwiki['iw_prefix']; - $name = Language::fetchLanguageName( $code, $language->getCode() ); - if ( !$name ) { - continue; - } - $title = Title::newFromText( "$code:" ); - if ( $title ) { - $url = $title->getFullURL(); - } else { - $url = ''; - } - $attrs = [ 'href' => $url ]; - $count++; - if ( $code == $this->getConfig()->get( 'LanguageCode' ) ) { - $attrs['class'] = 'selected'; - } - $selector .= Html::openElement( 'li' ); - $selector .= Html::element( 'a', $attrs, $name ); - $selector .= Html::closeElement( 'li' ); - } - - if ( $selector && $count > 1 ) { - $selector = <<<HTML - <p>{$this->msg( 'mobile-frontend-settings-site-description', $count )->parse()}</p> - <ul id='mw-mf-language-list'> - {$selector} - </ul> -HTML; - } - - return $selector; - } - - /** - * Render the language selector special page, callable through Special:MobileOptions/Language - * See the $options member variable of this class. - */ - private function chooseLanguage() { - $out = $this->getOutput(); - $out->setPageTitle( $this->msg( 'mobile-frontend-settings-site-header' )->escaped() ); - $out->addHTML( $this->getSiteSelector() ); - } - - /** * Saves the settings submitted by the settings form */ private function submitSettingsForm() { @@ -239,12 +168,5 @@ $context->setMobileMode( $group ); $url = $this->getPageTitle()->getFullURL( 'success' ); $context->getOutput()->redirect( MobileContext::singleton()->getMobileUrl( $url ) ); - } - - /** - * @return string[] - */ - public function getSubpagesForPrefixSearch() { - return array_keys( $this->options ); } } -- To view, visit https://gerrit.wikimedia.org/r/403062 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I9c7cca88c4f3df42f2ced93b72011f18d911acce Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/MobileFrontend Gerrit-Branch: master Gerrit-Owner: Jdlrobson <jrob...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits