function get_bandwidth_history_function() { /** * The first line of response is a number in decimal n. * The next n lines are 2 decimal numbers seperated by ",". * The first is download rate. The second is upload rate. * Each line represents 1 second. They are in chronological order. * Line breaks are "\n". */ header('Content-type: text/plain'); if (compare_version(array(0, 2, 6, 3))) { $getinfo_values = parse_getinfo('bw-event-cache'); if ($getinfo_values->num == 1) { $bandwidth_data = explode(' ', $getinfo_values->lines[0]); echo count($bandwidth_data), "\n"; foreach ($bandwidth_data as $a) { echo $a, "\n"; } } } else { echo "0\n"; } close_tc(); exit; }
$ls = sizeof($l); $rs = sizeof($r); for ($i = 0; $i < max($ls, $rs); $i++) { $ll = $i < $ls ? $l[$i] : 0; $rr = $i < $rs ? $r[$i] : 0; if ($ll < $rr) { return -1; } if ($ll > $rr) { return 1; } } return 0; } $v = $_GET['version']; include "rules.php"; $out = "current"; if (isset($v) && !is_null($v)) { foreach (array_keys($rules) as $r) { if (compare_version($v, $r) <= 0) { $out = $rules[$r]; break; } } } if (array_key_exists('HTTPS', $_SERVER)) { $host = 'https://updates.jenkins-ci.org/'; } else { $host = 'http://mirrors.jenkins-ci.org/updates/'; } header('Location: ' . $host . $out . '/' . $_GET['path']);
/** * Quick-hand for checking if a version number is greater-than-or-equal-to */ function gte_version($version1, $version2) { if (in_array(compare_version($version1, $version2), array(0, 1))) { return true; } return false; }
return -1; } if ($ad) { $result = strnatcasecmp($a['browser'], $b['browser']); if ($result == 0) { $result = strnatcasecmp($a['platform'], $b['platform']); if ($result == 0) { $result = compare_version($a['version'], $b['version']); } } } else { $result = strnatcasecmp($a['platform'], $b['platform']); if ($result == 0) { $result = strnatcasecmp($a['browser'], $b['browser']); if ($result == 0) { $result = compare_version($a['version'], $b['version']); } } } if ($result == 0) { $result = strnatcasecmp($a['key'], $b['key']); } return $result; }); foreach ($uas as &$val) { unset($val['key']); } $jsonPretty = new Camspiers\JsonPretty\JsonPretty(); echo $jsonPretty->prettify($uas); file_put_contents($jsonfile, $jsonPretty->prettify($uas)); function compare_version($a, $b)