Index: trunk/extensions/LandingCheck/SpecialLandingCheck.php |
— | — | @@ -11,6 +11,13 @@ |
12 | 12 | */ |
13 | 13 | class SpecialLandingCheck extends SpecialPage { |
14 | 14 | 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; |
15 | 22 | |
16 | 23 | public function __construct() { |
17 | 24 | // Register special page |
— | — | @@ -22,8 +29,9 @@ |
23 | 30 | |
24 | 31 | // Pull in query string parameters |
25 | 32 | $language = $wgRequest->getVal( 'language', 'en' ); |
| 33 | + $this->basic = $wgRequest->getBool( 'basic' ); |
| 34 | + $country = $wgRequest->getVal( 'country' ); |
26 | 35 | |
27 | | - $country = $wgRequest->getVal( 'country' ); |
28 | 36 | // If no country was passed, try to do GeoIP lookup |
29 | 37 | // Requires php5-geoip package |
30 | 38 | if ( !$country && function_exists( 'geoip_country_code_by_name' ) ) { |
— | — | @@ -85,8 +93,11 @@ |
86 | 94 | */ |
87 | 95 | public function routeRedirect( $country, $language, $priority ) { |
88 | 96 | $localServerType = $this->getLocalServerType(); |
89 | | - |
90 | | - if ( $localServerType == 'local' ) { |
| 97 | + |
| 98 | + if ( $this->basic ) { |
| 99 | + $this->localRedirect( $country, $language, false ); |
| 100 | + |
| 101 | + } elseif ( $localServerType == 'local' ) { |
91 | 102 | $this->localRedirect( $country, $language, $priority ); |
92 | 103 | |
93 | 104 | } elseif ( $priority && $localServerType == 'priority' ) { |
— | — | @@ -169,7 +180,11 @@ |
170 | 181 | foreach ( $targetTexts as $targetText ) { |
171 | 182 | $target = Title::newFromText( $targetText ); |
172 | 183 | 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 | + } |
174 | 189 | return; |
175 | 190 | } |
176 | 191 | } |