Skip to content

Commit 63c6e7c

Browse files
authored
Merge pull request #3068 from catchpoint/disable_traceroute
Disable traceroute test type by default
2 parents ff57093 + 9b20e46 commit 63c6e7c

File tree

8 files changed

+57
-3
lines changed

8 files changed

+57
-3
lines changed

www/header.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ if (!EMBED) {
104104
$showUrl = $numSteps > 1 || !$url ? $gradeRunResults->getStepResult(1)->getUrl() : $url;
105105
echo "<ul class=\"header_data_urltime\">";
106106

107-
if ($test['testinfo']['type'] === "traceroute") {
107+
if (GetSetting('traceroute_enabled') && $test['testinfo']['type'] === "traceroute") {
108108
$showUrl = "http://" . $showUrl;
109109
echo "<li><strong>HOST/IP: </strong>";
110110
} else {

www/running.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
if (GetSetting('nolinks')) {
5454
echo "URL: $url<br>\n";
5555
} else {
56-
if ($test['testinfo']['type'] === "traceroute") {
56+
if (GetSetting('traceroute_enabled') && $test['testinfo']['type'] === "traceroute") {
5757
echo "Host/IP: <a class=\"urlLinkWrap\" rel=\"nofollow\" href=\"http://$url\" target=\"_blank\">$url</a><br>\n";
5858
} else {
5959
echo "URL: <a class=\"urlLinkWrap\" rel=\"nofollow\" href=\"$url\" target=\"_blank\">$url</a><br>\n";

www/runtest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1923,6 +1923,9 @@ function ValidateParameters(&$test, $locations, &$error, $destination_url = null
19231923
}
19241924

19251925
if (isset($test['type']) && strlen($test['type']) && $test['type'] === 'traceroute') {
1926+
if (!GetSetting('traceroute_enabled')) {
1927+
$error = "traceroute test type not supported";
1928+
}
19261929
// make sure we're just passing a host name
19271930
$parts = parse_url($test['url']);
19281931
$test['url'] = $parts['host'];

www/templates/account/includes/signup.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
</td>
7171
</tr>
7272

73+
<?php if (GetSetting('traceroute_enabled')): ?>
7374
<tr>
7475
<th scope="col">Traceroute</th>
7576
<td>
@@ -81,6 +82,7 @@
8182
<span class="visually-hidden">Yes</span>
8283
</td>
8384
</tr>
85+
<?php endif; ?>
8486

8587
<tr>
8688
<th scope="col">Test History</th>

www/templates/account/plans/upgrade-plan.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,9 @@
9797
<li>All Connection Speeds</li>
9898
<li>Filmstrip and Video</li>
9999
<li>Google Lighthouse</li>
100+
<?php if (GetSetting('traceroute_enabled')): ?>
100101
<li>Traceroute</li>
102+
<?php endif; ?>
101103
<li>13 month Test History</li>
102104
<li>Priority Tests</li>
103105
<li>API Access</li>

www/templates/account/signup/step-1.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@
128128
</td>
129129
</tr>
130130

131+
<?php if (GetSetting('traceroute_enabled')): ?>
131132
<tr>
132133
<th scope="col">Traceroute</th>
133134
<td>
@@ -139,6 +140,7 @@
139140
<span class="visually-hidden">Yes</span>
140141
</td>
141142
</tr>
143+
<?php endif; ?>
142144

143145
<tr>
144146
<th scope="col">Test History</th>

www/testTypesNav.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@
1919

2020
$testTypes['Lighthouse'] = '/lighthouse';
2121
$testTypes['Visual Comparison'] = '/video';
22-
$testTypes['Traceroute'] = '/traceroute';
22+
23+
if (GetSetting('traceroute_enabled')) {
24+
$testTypes['Traceroute'] = '/traceroute';
25+
}
2326

2427
unset($testTypes[$currNav]);
2528
?>

www/traceroute.php

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,48 @@
55
// found in the LICENSE.md file.
66
include 'common.inc';
77

8+
use WebPageTest\Util;
9+
10+
if(!GetSetting('traceroute_enabled')):
11+
?>
12+
13+
<!DOCTYPE html>
14+
<html lang="en-us">
15+
16+
<head>
17+
<title>WebPageTest - Traceroute diagnostic</title>
18+
<?php include('head.inc'); ?>
19+
</head>
20+
21+
<body class="home feature-pro">
22+
23+
<body class="home feature-pro">
24+
<?php
25+
$tab = 'Traceroute';
26+
include 'header.inc';
27+
?>
28+
29+
<?php include("home_header.php"); ?>
30+
31+
<div class="home_content_contain">
32+
<div class="home_content">
33+
<div id="test_box-container" class="home_responsive_test">
34+
<h2>
35+
<span>
36+
Traceroute test type not supported
37+
</span>
38+
</h2>
39+
</div>
40+
41+
<div style="position: absolute; bottom: 0">
42+
<?php include('footer.inc'); ?>
43+
</div>
44+
</div><!--home_content_contain-->
45+
</div><!--home_content-->
46+
</body>
47+
<?php die(); endif; ?>
48+
49+
<?php
850
$current_user = $request_context->getUser();
951
$is_paid = !is_null($current_user) ? $current_user->isPaid() : false;
1052

0 commit comments

Comments
 (0)