[MediaWiki-commits] [Gerrit] mediawiki...LandingCheck[master]: Add phpcs and make pass

2017-05-17 Thread Umherirrender (Code Review)
Umherirrender has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/354145 )

Change subject: Add phpcs and make pass
..

Add phpcs and make pass

Change-Id: I6191d21e02f88fcf42d20fe8e75cd7aec4627d6e
---
M SpecialLandingCheck.php
M composer.json
A phpcs.xml
3 files changed, 58 insertions(+), 50 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/LandingCheck 
refs/changes/45/354145/1

diff --git a/SpecialLandingCheck.php b/SpecialLandingCheck.php
index f175c1e..a1a7858 100644
--- a/SpecialLandingCheck.php
+++ b/SpecialLandingCheck.php
@@ -5,14 +5,14 @@
 }
 
 /**
- * This checks to see if a version of a landing page exists for the user's 
language and country. 
- * If not, it looks for a version localized for the user's language. If that 
doesn't exist either, 
+ * This checks to see if a version of a landing page exists for the user's 
language and country.
+ * If not, it looks for a version localized for the user's language. If that 
doesn't exist either,
  * it looks for the English version. If any of those exist, it then redirects 
the user.
  */
 class SpecialLandingCheck extends SpecialPage {
protected $localServerType = null;
/**
-* If basic is set to true, do a local redirect, ignore priority, and 
don't pass tracking 
+* If basic is set to true, do a local redirect, ignore priority, and 
don't pass tracking
 * params. This is for non-fundraising links that just need 
localization.
 *
 * @var boolean $basic
@@ -27,12 +27,12 @@
 * @var string $anchor
 */
protected $anchor = null;
-   
+
public function __construct() {
// Register special page
parent::__construct( 'LandingCheck' );
}
-   
+
public function execute( $sub ) {
global $wgPriorityCountries;
$request = $this->getRequest();
@@ -41,7 +41,7 @@
 
$language = 'en';
$path = explode( '/', $sub );
-   if ( Language::isValidCode( $path[count($path) - 1] ) ) {
+   if ( Language::isValidCode( $path[count( $path ) - 1] ) ) {
$language = $sub;
}
 
@@ -49,10 +49,10 @@
$language = $request->getVal( 'language', $language );
$this->basic = $request->getBool( 'basic' );
$country = $request->getVal( 'country' );
-   $this->anchor = $request->getVal ( 'anchor' );
+   $this->anchor = $request->getVal( 'anchor' );
 
// if the language is false-ish, set to default
-   if( !$language ) {
+   if ( !$language ) {
$language = 'en';
}
 
@@ -75,25 +75,25 @@
if ( !$country ) {
$country = 'US'; // Default
}
-   
+
// determine if we are fulfilling a request for a priority 
country
$priority = in_array( $country, $wgPriorityCountries );
 
// handle the actual redirect
$this->routeRedirect( $country, $language, $priority );
}
-   
+
/**
 * Determine whether this server is configured as the priority or 
normal server
-* 
+*
 * If this is neither the priority nor normal server, assumes 'local' - 
meaning
 * this server should be handling the request.
 */
public function determineLocalServerType() {
global $wgServer, $wgLandingCheckPriorityURLBase, 
$wgLandingCheckNormalURLBase;
-   
+
$localServerDetails = wfParseUrl( $wgServer );
-   
+
// The following checks are necessary due to a bug in 
wfParseUrl that was fixed in r94352.
if ( $wgLandingCheckPriorityURLBase ) {
$priorityServerDetails = wfParseUrl( 
$wgLandingCheckPriorityURLBase );
@@ -105,9 +105,7 @@
} else {
$normalServerDetails = false;
}
-   //$priorityServerDetails = wfParseUrl( 
$wgLandingCheckPriorityURLBase );
-   //$normalServerDetails = wfParseUrl( 
$wgLandingCheckNormalURLBase );
-   
+
if ( $localServerDetails[ 'host' ] == $priorityServerDetails[ 
'host' ] ) {
return 'priority';
} elseif ( $localServerDetails[ 'host' ] == 
$normalServerDetails[ 'host' ] ) {
@@ -116,7 +114,7 @@
return 'local';
}
}
-   
+
/**
 * Route the request to the appropriate redirect method
 * @param string $country
@@ -125,28 +123,27 @@
 */
public function routeRedirect( $country, $language, $priority ) {
$localServerType = $this->getLocalSer

[MediaWiki-commits] [Gerrit] mediawiki...LandingCheck[master]: Add phpcs and make pass

2017-05-18 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/354145 )

Change subject: Add phpcs and make pass
..


Add phpcs and make pass

Change-Id: I6191d21e02f88fcf42d20fe8e75cd7aec4627d6e
---
M SpecialLandingCheck.php
M composer.json
A phpcs.xml
3 files changed, 58 insertions(+), 50 deletions(-)

Approvals:
  jenkins-bot: Verified
  Jforrester: Looks good to me, approved



diff --git a/SpecialLandingCheck.php b/SpecialLandingCheck.php
index f175c1e..a1a7858 100644
--- a/SpecialLandingCheck.php
+++ b/SpecialLandingCheck.php
@@ -5,14 +5,14 @@
 }
 
 /**
- * This checks to see if a version of a landing page exists for the user's 
language and country. 
- * If not, it looks for a version localized for the user's language. If that 
doesn't exist either, 
+ * This checks to see if a version of a landing page exists for the user's 
language and country.
+ * If not, it looks for a version localized for the user's language. If that 
doesn't exist either,
  * it looks for the English version. If any of those exist, it then redirects 
the user.
  */
 class SpecialLandingCheck extends SpecialPage {
protected $localServerType = null;
/**
-* If basic is set to true, do a local redirect, ignore priority, and 
don't pass tracking 
+* If basic is set to true, do a local redirect, ignore priority, and 
don't pass tracking
 * params. This is for non-fundraising links that just need 
localization.
 *
 * @var boolean $basic
@@ -27,12 +27,12 @@
 * @var string $anchor
 */
protected $anchor = null;
-   
+
public function __construct() {
// Register special page
parent::__construct( 'LandingCheck' );
}
-   
+
public function execute( $sub ) {
global $wgPriorityCountries;
$request = $this->getRequest();
@@ -41,7 +41,7 @@
 
$language = 'en';
$path = explode( '/', $sub );
-   if ( Language::isValidCode( $path[count($path) - 1] ) ) {
+   if ( Language::isValidCode( $path[count( $path ) - 1] ) ) {
$language = $sub;
}
 
@@ -49,10 +49,10 @@
$language = $request->getVal( 'language', $language );
$this->basic = $request->getBool( 'basic' );
$country = $request->getVal( 'country' );
-   $this->anchor = $request->getVal ( 'anchor' );
+   $this->anchor = $request->getVal( 'anchor' );
 
// if the language is false-ish, set to default
-   if( !$language ) {
+   if ( !$language ) {
$language = 'en';
}
 
@@ -75,25 +75,25 @@
if ( !$country ) {
$country = 'US'; // Default
}
-   
+
// determine if we are fulfilling a request for a priority 
country
$priority = in_array( $country, $wgPriorityCountries );
 
// handle the actual redirect
$this->routeRedirect( $country, $language, $priority );
}
-   
+
/**
 * Determine whether this server is configured as the priority or 
normal server
-* 
+*
 * If this is neither the priority nor normal server, assumes 'local' - 
meaning
 * this server should be handling the request.
 */
public function determineLocalServerType() {
global $wgServer, $wgLandingCheckPriorityURLBase, 
$wgLandingCheckNormalURLBase;
-   
+
$localServerDetails = wfParseUrl( $wgServer );
-   
+
// The following checks are necessary due to a bug in 
wfParseUrl that was fixed in r94352.
if ( $wgLandingCheckPriorityURLBase ) {
$priorityServerDetails = wfParseUrl( 
$wgLandingCheckPriorityURLBase );
@@ -105,9 +105,7 @@
} else {
$normalServerDetails = false;
}
-   //$priorityServerDetails = wfParseUrl( 
$wgLandingCheckPriorityURLBase );
-   //$normalServerDetails = wfParseUrl( 
$wgLandingCheckNormalURLBase );
-   
+
if ( $localServerDetails[ 'host' ] == $priorityServerDetails[ 
'host' ] ) {
return 'priority';
} elseif ( $localServerDetails[ 'host' ] == 
$normalServerDetails[ 'host' ] ) {
@@ -116,7 +114,7 @@
return 'local';
}
}
-   
+
/**
 * Route the request to the appropriate redirect method
 * @param string $country
@@ -125,28 +123,27 @@
 */
public function routeRedirect( $country, $language, $priority ) {
$localServerType = $this->getLocalServerType();
-