Title: [162693] trunk/Websites/test-results
Revision
162693
Author
rn...@webkit.org
Date
2014-01-23 22:12:57 -0800 (Thu, 23 Jan 2014)

Log Message

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):

Modified Paths

Diff

Modified: trunk/Websites/test-results/ChangeLog (162692 => 162693)


--- trunk/Websites/test-results/ChangeLog	2014-01-24 06:07:31 UTC (rev 162692)
+++ trunk/Websites/test-results/ChangeLog	2014-01-24 06:12:57 UTC (rev 162693)
@@ -1,3 +1,20 @@
+2014-01-23  Ryosuke Niwa  <rn...@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  <rn...@webkit.org>
 
         New flakiness dashboard should generate JSON in the background process

Modified: trunk/Websites/test-results/public/include/json-shared.php (162692 => 162693)


--- trunk/Websites/test-results/public/include/json-shared.php	2014-01-24 06:07:31 UTC (rev 162692)
+++ trunk/Websites/test-results/public/include/json-shared.php	2014-01-24 06:12:57 UTC (rev 162693)
@@ -1,6 +1,6 @@
 <?php
 
-require_once('../include/db.php');
+require_once('db.php');
 
 header('Content-type: application/json');
 $maxage = config('jsonCacheMaxAge');
@@ -9,12 +9,16 @@
 
 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);
 }
 
@@ -23,6 +27,21 @@
     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())
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to