Skip to content

Commit 4436d74

Browse files
authored
Merge pull request catchpoint#2165 from WPO-Foundation/reforma
Reformat php, js, css
2 parents b134c85 + 98943d2 commit 4436d74

274 files changed

Lines changed: 36562 additions & 33193 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

bulktest/gethar.php

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,65 @@
11
<?php
2+
23
include './settings.inc';
34

45
$results = array();
56

67
// see if there is an existing test we are working with
7-
if( LoadResults($results) ) {
8+
if (LoadResults($results)) {
89
// count the number of tests that don't have status yet
910
$testCount = 0;
10-
foreach( $results as &$result )
11-
if (array_key_exists('id', $result) &&
11+
foreach ($results as &$result) {
12+
if (
13+
array_key_exists('id', $result) &&
1214
strlen($result['id']) &&
1315
array_key_exists('result', $result) &&
14-
strlen($result['result']))
16+
strlen($result['result'])
17+
) {
1518
$testCount++;
19+
}
20+
}
1621

17-
if( $testCount ) {
22+
if ($testCount) {
1823
echo "Retrieving HAR files for $testCount tests...\r\n";
1924

20-
if( !is_dir('./har') )
25+
if (!is_dir('./har')) {
2126
mkdir('./har');
27+
}
2228

2329
$count = 0;
24-
foreach( $results as &$result ) {
25-
if (array_key_exists('id', $result) &&
30+
foreach ($results as &$result) {
31+
if (
32+
array_key_exists('id', $result) &&
2633
strlen($result['id']) &&
2734
array_key_exists('result', $result) &&
28-
strlen($result['result'])) {
35+
strlen($result['result'])
36+
) {
2937
$count++;
3038
echo "\rRetrieving HAR for test $count of $testCount... ";
3139

3240
$file = $result['id'] . '-' . BuildFileName($result['url']);
33-
if( strlen($file) && !is_file("./har/$file.har") )
34-
{
41+
if (strlen($file) && !is_file("./har/$file.har")) {
3542
$response = file_get_contents("{$server}export.php?test={$result['id']}&medianRun=fastest&run=median&bodies=1&pretty=1&cached=0");
36-
if( strlen($response) )
43+
if (strlen($response)) {
3744
file_put_contents("./har/$file.har", $response);
45+
}
3846
}
3947
}
4048
}
4149

4250
// clear the progress text
4351
echo "\r \r";
4452
echo "Done\r\n";
45-
}
46-
else
53+
} else {
4754
echo "No HAR files available for download\r\n";
55+
}
56+
} else {
57+
echo "No tests found in results.txt\r\n";
4858
}
49-
else
50-
echo "No tests found in results.txt\r\n";
5159

5260
/**
5361
* Create a file name given an url
54-
*
62+
*
5563
* @param mixed $results
5664
*/
5765
function BuildFileName($url)

bulktest/resubmit.php

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
require_once('./settings.inc');
34

45
$res = array();
@@ -12,23 +13,28 @@
1213
$count = 0;
1314
foreach ($res as &$result) {
1415
$stddev = 0;
15-
if (array_key_exists('docTime', $result) &&
16+
if (
17+
array_key_exists('docTime', $result) &&
1618
array_key_exists('docTime.stddev', $result) &&
17-
$result['docTime'] > 0)
19+
$result['docTime'] > 0
20+
) {
1821
$stddev = ($result['docTime.stddev'] / $result['docTime']) * 100;
19-
if (!array_key_exists('id', $result) ||
20-
!strlen($result['id']) ||
22+
}
23+
if (
24+
!array_key_exists('id', $result) ||
25+
!strlen($result['id']) ||
2126
!array_key_exists('result', $result) ||
22-
!strlen($result['result']) ||
23-
($result['result'] != 0 &&
27+
!strlen($result['result']) ||
28+
($result['result'] != 0 &&
2429
$result['result'] != 99999) ||
2530
!$result['bytesInDoc'] ||
2631
!$result['docTime'] ||
2732
!$result['TTFB'] ||
2833
$result['TTFB'] > $result['docTime'] ||
2934
$stddev > $maxVariancePct || // > 10% variation in results
3035
(isset($maxBandwidth) && $maxBandwidth && (($result['bytesInDoc'] * 8) / $result['docTime']) > $maxBandwidth) ||
31-
($video && (!$result['SpeedIndex'] || !$result['render'] || !$result['visualComplete']))) {
36+
($video && (!$result['SpeedIndex'] || !$result['render'] || !$result['visualComplete']))
37+
) {
3238
$result['resubmit'] = true;
3339
$count++;
3440
}

0 commit comments

Comments
 (0)