<?php require_once './lib/S3.php'; gsUpload('./gstest.php', 'httparchive', 'desktop-test/test.txt'); function gsUpload($file, $bucket, $remoteFile) { $ret = false; $key = 'GOOGT4X7CFTWS2VWN2HT'; $secret = 'SEWZTyKZH6dNbjbT2CHg5Q5pUh5Y5+iinj0yBFB4'; $server = 'storage.googleapis.com'; $s3 = new S3($key, $secret, false, $server); $metaHeaders = array(); $requestHeaders = array(); if ($s3->putObject($s3->inputFile($file, false), $bucket, $remoteFile, S3::ACL_PUBLIC_READ, $metaHeaders, $requestHeaders)) { $ret = true; } return $ret; }
mkdir($harDir, 0777, true); if (CollectHARs($testIDs, $harDir)) { logMessage("Uploading to Google storage..."); if (gsUpload($harDir, $name)) { logMessage("Upload complete..."); } else { $ok = false; } } else { $ok = false; } delTree($harDir); logMessage("{$id} - {$count} {$type} tests (traces): {$traceDir}"); mkdir($traceDir, 0777, true); if (CollectTraces($testIDs, $traceDir)) { gsUpload($traceDir, "traces-{$name}"); } delTree($traceDir); } } } if ($ok) { file_put_contents("{$dir}/har.complete", ''); } } else { // Bogus test data, mark it as done file_put_contents("{$dir}/har.complete", ''); logMessage("{$id} - No tests available"); } } else { if (!is_file("{$dir}/testing.complete")) {
function MarkDone() { global $tempDir; global $name; $marker = "{$tempDir}/done.txt"; file_put_contents($marker, ""); $file = realpath($marker); $remoteFile = "{$name}/done.txt"; $bucket = 'httparchive'; gsUpload($file, $bucket, $remoteFile); }