Merge database-common.js and utility.js into run-tests.js.
[WebKit-https.git] / Websites / perf.webkit.org / public / admin / reprocess-report.php
1 <?php
2
3 require_once('../include/json-header.php');
4 require_once('../include/manifest.php');
5 require_once('../include/report-processor.php');
6
7 $db = new Database;
8 if (!$db->connect())
9     exit_with_error('DatabaseConnectionFailure');
10
11 $report_id = array_get($_POST, 'report');
12 if (!$report_id)
13     $report_id = array_get($_GET, 'report');
14 $report_id = intval($report_id);
15 if (!$report_id)
16     exit_with_error('ReportIdNotSpecified');
17
18 $report_row = $db->select_first_row('reports', 'report', array('id' => $report_id));
19 if (!$report_row)
20     return exit_with_error('ReportNotFound', array('reportId', $report_id));
21
22 $processor = new ReportProcessor($db);
23 $processor->process(json_decode($report_row['report_content'], true), $report_id);
24
25 $generator = new ManifestGenerator($db);
26 if (!$generator->generate())
27     exit_with_error('FailedToGenerateManifest');
28 else if (!$generator->store())
29     exit_with_error('FailedToStoreManifest');
30
31 exit_with_success();
32
33 ?>