r106159 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r106158‎ | r106159 | r106160 >
Date:01:38, 14 December 2011
Author:kaldari
Status:ok
Tags:
Comment:
adding "basic" functionality to LandingCheck
Modified paths:
  • /trunk/extensions/LandingCheck/SpecialLandingCheck.php (modified) (history)

Diff [purge]

Index: trunk/extensions/LandingCheck/SpecialLandingCheck.php
@@ -11,6 +11,13 @@
1212 */
1313 class SpecialLandingCheck extends SpecialPage {
1414 protected $localServerType = null;
 15+ /**
 16+ * If basic is set to true, do a local redirect, ignore priority, and don't pass tracking
 17+ * params. This is for non-fundraising links that just need localization.
 18+ *
 19+ * @var boolean $basic
 20+ */
 21+ protected $basic = false;
1522
1623 public function __construct() {
1724 // Register special page
@@ -22,8 +29,9 @@
2330
2431 // Pull in query string parameters
2532 $language = $wgRequest->getVal( 'language', 'en' );
 33+ $this->basic = $wgRequest->getBool( 'basic' );
 34+ $country = $wgRequest->getVal( 'country' );
2635
27 - $country = $wgRequest->getVal( 'country' );
2836 // If no country was passed, try to do GeoIP lookup
2937 // Requires php5-geoip package
3038 if ( !$country && function_exists( 'geoip_country_code_by_name' ) ) {
@@ -85,8 +93,11 @@
8694 */
8795 public function routeRedirect( $country, $language, $priority ) {
8896 $localServerType = $this->getLocalServerType();
89 -
90 - if ( $localServerType == 'local' ) {
 97+
 98+ if ( $this->basic ) {
 99+ $this->localRedirect( $country, $language, false );
 100+
 101+ } elseif ( $localServerType == 'local' ) {
91102 $this->localRedirect( $country, $language, $priority );
92103
93104 } elseif ( $priority && $localServerType == 'priority' ) {
@@ -169,7 +180,11 @@
170181 foreach ( $targetTexts as $targetText ) {
171182 $target = Title::newFromText( $targetText );
172183 if ( $target && $target->isKnown() && $target->getNamespace() == NS_MAIN ) {
173 - $wgOut->redirect( $target->getLocalURL( $tracking ) );
 184+ if ( $this->basic ) {
 185+ $wgOut->redirect( $target->getLocalURL() );
 186+ } else {
 187+ $wgOut->redirect( $target->getLocalURL( $tracking ) );
 188+ }
174189 return;
175190 }
176191 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r106377MFT r106136, r106159, r106160awjrichards21:34, 15 December 2011

Status & tagging log