+2014-01-23 Ryosuke Niwa <rniwa@webkit.org>
+
+ Upstream changes to json-shared.php from the perf dashboard
+ https://bugs.webkit.org/show_bug.cgi?id=127544
+
+ Reviewed by Joseph Pecoraro.
+
+ json-shared.php originated from the perf dashboard.
+ Upstream changes made to the version in the perf. dashboard so that two apps could share the same code.
+
+ * public/include/json-shared.php:
+ (exit_with_error):
+ (echo_success):
+ (exit_with_success):
+ (set_exit_detail):
+ (merge_additional_details):
+
2013-11-06 Ryosuke Niwa <rniwa@webkit.org>
New flakiness dashboard should generate JSON in the background process
<?php
-require_once('../include/db.php');
+require_once('db.php');
header('Content-type: application/json');
$maxage = config('jsonCacheMaxAge');
function exit_with_error($status, $details = array()) {
$details['status'] = $status;
+ merge_additional_details($details);
+
echo json_encode($details);
exit(1);
}
function echo_success($details = array()) {
$details['status'] = 'OK';
+ merge_additional_details($details);
+
echo json_encode($details);
}
exit(0);
}
+$additional_exit_details = array();
+
+function set_exit_detail($name, $value) {
+ global $additional_exit_details;
+ $additional_exit_details[$name] = $value;
+}
+
+function merge_additional_details(&$details) {
+ global $additional_exit_details;
+ foreach ($additional_exit_details as $name => $value) {
+ if (!array_key_exists($name, $details))
+ $details[$name] = $value;
+ }
+}
+
function connect() {
$db = new Database;
if (!$db->connect())