Created
June 13, 2013 21:31
-
-
Save jklein/5777553 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: webpagetest/runtest.php | |
=================================================================== | |
--- webpagetest/runtest.php (revision 1932) | |
+++ webpagetest/runtest.php (working copy) | |
@@ -917,9 +917,13 @@ | |
else | |
{ | |
// see if we need to pick the default connectivity | |
- if( (!isset($locations[$test['location']]['connectivity']) || !strlen($locations[$test['location']]['connectivity'])) && !isset($test['connectivity']) ) | |
+ if( (!isset($locations[$test['location']]['connectivity']) || !strlen($locations[$test['location']]['connectivity'])) && !isset($test['connectivity']) ) { | |
$test['connectivity'] = 'Cable'; | |
+ } elseif (isset($locations[$test['location']]['connectivity'])) { | |
+ $test['connectivity'] = $locations[$test['location']]['connectivity']; | |
+ } | |
if( isset($test['browser']) && strlen($test['browser']) ) | |
$test['locationText'] .= " - <b>{$test['browser']}</b>"; | |
if( isset($test['connectivity']) ) |
Something more like this:
if( (!array_key_exists('connectivity', $locations[$test['location']]) ||
!strlen($locations[$test['location']]['connectivity'])) &&
!isset($test['connectivity'])) {
if (array_key_exists('default connectivity', $locations[$test['location']]) &&
strlen($locations[$test['location']]['default connectivity']))
$test['connectivity'] = $locations[$test['location']]['default connectivity'];
else
$test['connectivity'] = 'Cable';
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You should probably use a new field in locations.ini instead of overriding "connectivity". The connectivity one is used to identify statically configured test agents where dummynet isn't available at all.
Would probably be better to have a new field like "default connectivity" and inside of the first if block, check to see if the field is defined. If so, use the value from the field and if not use "Cable".