Skip to content

Instantly share code, notes, and snippets.

@jklein
Created June 13, 2013 21:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jklein/5777553 to your computer and use it in GitHub Desktop.
Save jklein/5777553 to your computer and use it in GitHub Desktop.
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']) )
@pmeenan
Copy link

pmeenan commented Jun 14, 2013

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