https://bugs.webkit.org/show_bug.cgi?id=140312
Reviewed by Andreas Kling.
Some JSON APIs such as api/analysis-tasks can't be cached even for a short period of time (e.g. a few minutes)
since they can be modified by the user on demand. Since only api/runs.php takes a long time to generate JSONs,
just set cache-control there instead of json-header.php which is used by other JSON APIs.
Also set date_default_timezone_set in db.php since we never use non-UTC timezone in our scripts.
* public/api/analysis-tasks.php:
* public/api/runs.php: Set the cache control headers.
* public/api/test-groups.php:
* public/include/db.php: Set the default timezone to UTC.
* public/include/json-header.php: Don't set the cache control headers.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@178208
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
2015-01-09 Ryosuke Niwa <rniwa@webkit.org>
+ Cache-control should be set only on api/runs
+ https://bugs.webkit.org/show_bug.cgi?id=140312
+
+ Reviewed by Andreas Kling.
+
+ Some JSON APIs such as api/analysis-tasks can't be cached even for a short period of time (e.g. a few minutes)
+ since they can be modified by the user on demand. Since only api/runs.php takes a long time to generate JSONs,
+ just set cache-control there instead of json-header.php which is used by other JSON APIs.
+
+ Also set date_default_timezone_set in db.php since we never use non-UTC timezone in our scripts.
+
+ * public/api/analysis-tasks.php:
+ * public/api/runs.php: Set the cache control headers.
+ * public/api/test-groups.php:
+ * public/include/db.php: Set the default timezone to UTC.
+ * public/include/json-header.php: Don't set the cache control headers.
+
+2015-01-09 Ryosuke Niwa <rniwa@webkit.org>
+
api/report-commit should authenticate with a slave name and password
https://bugs.webkit.org/show_bug.cgi?id=140308
return $bugs;
}
-date_default_timezone_set('UTC');
function format_task($task_row) {
return array(
'id' => $task_row['task_id'],
if (!$db->connect())
exit_with_error('DatabaseConnectionFailure');
+// FIXME: We should support revalication as well as caching results in the server side.
+$maxage = config('jsonCacheMaxAge');
+header('Expires: ' . gmdate('D, d M Y H:i:s', time() + $maxage) . ' GMT');
+header("Cache-Control: maxage=$maxage");
+
$platform_id = intval($parts[0]);
$metric_id = intval($parts[1]);
$config_rows = $db->query_and_fetch_all('SELECT config_id, config_type, config_platform, config_metric
return $formatted_runs;
}
-date_default_timezone_set('UTC');
function parse_revisions_array($postgres_array) {
global $repository_id_to_name;
WHERE request_build = build_id AND request_group = $1 ORDER BY request_order', array($test_group_id));
}
-date_default_timezone_set('UTC');
function format_test_group($group_row) {
return array(
'id' => $group_row['testgroup_id'],
} else
error_reporting(E_ERROR);
+date_default_timezone_set('UTC');
+
class Database
{
private $connection = false;
require_once('db.php');
header('Content-type: application/json');
-$maxage = config('jsonCacheMaxAge');
-header('Expires: ' . gmdate('D, d M Y H:i:s', time() + $maxage) . ' GMT');
-header("Cache-Control: maxage=$maxage");
function exit_with_error($status, $details = array()) {
$details['status'] = $status;