Mercurial > hg > webaudioevaluationtool
annotate pseudo.php @ 1364:0a33be453688
Added Pseudo-random test loading for PHP. Runs of the tests completed count, same as PHP, so multiple requests at the same time will load the same test.
author | Nicholas Jillings <nickjillings@users.noreply.github.com> |
---|---|
date | Tue, 26 Jan 2016 18:18:55 +0000 |
parents | |
children |
rev | line source |
---|---|
nickjillings@1364 | 1 <?php |
nickjillings@1364 | 2 header('Access-Control-Allow-Origin: *'); |
nickjillings@1364 | 3 header("Content-type: text/xml"); |
nickjillings@1364 | 4 $files = glob('saves/' . '*.xml'); |
nickjillings@1364 | 5 $numsaves = 0; |
nickjillings@1364 | 6 if ( $files !== false ) |
nickjillings@1364 | 7 { |
nickjillings@1364 | 8 $numsaves = count( $files ); |
nickjillings@1364 | 9 } |
nickjillings@1364 | 10 |
nickjillings@1364 | 11 $files = glob('pseudo/' . '*.xml'); |
nickjillings@1364 | 12 $numtests = 0; |
nickjillings@1364 | 13 if ( $numtests !== false ) |
nickjillings@1364 | 14 { |
nickjillings@1364 | 15 $numtests = count( $files ); |
nickjillings@1364 | 16 } |
nickjillings@1364 | 17 |
nickjillings@1364 | 18 $testID = ($numsaves % $numtests)-1; |
nickjillings@1364 | 19 |
nickjillings@1364 | 20 readfile($files[$testID]); |
nickjillings@1364 | 21 ?> |