Skip to content

Commit 3a48908

Browse files
authored
Add API for QA (#1262)
1 parent e68d687 commit 3a48908

File tree

2 files changed

+93
-0
lines changed

2 files changed

+93
-0
lines changed

openapi.yml

+66
Original file line numberDiff line numberDiff line change
@@ -92,3 +92,69 @@ paths:
9292
type: string
9393
format: date-time
9494

95+
"/release-candidates.php":
96+
get:
97+
summary: "Currently RC versions of PHP."
98+
parameters:
99+
- in: query
100+
name: format
101+
schema:
102+
type: string
103+
enum: [ "json", "serialize" ]
104+
required: false
105+
description: Output format
106+
- in: query
107+
name: only
108+
schema:
109+
type: string
110+
enum: [ "dev_versions" ]
111+
required: false
112+
description: Include only dev version numbers
113+
114+
responses:
115+
"200":
116+
description: "Actively RC per-branch versions of PHP."
117+
content:
118+
"application/json":
119+
schema:
120+
type: array
121+
items:
122+
type: object
123+
properties:
124+
active:
125+
description: "Whether RC version is active"
126+
type: boolean
127+
release:
128+
type: object
129+
properties:
130+
type:
131+
description: "Unstable release type"
132+
type: string
133+
enum:
134+
- alpha
135+
- beta
136+
- RC
137+
number:
138+
description: "Unstable release number"
139+
type: integer
140+
sha256_gz:
141+
description: "Unstable release gz hash"
142+
type: string
143+
sha256_bz2:
144+
description: "Unstable release bz2 hash"
145+
type: string
146+
sha256_xz:
147+
description: "Unstable release xz hash"
148+
type: string
149+
date:
150+
description: "Date of release"
151+
type: string
152+
baseurl:
153+
description: "Download base URL"
154+
type: string
155+
enabled:
156+
description: "enabled"
157+
type: boolean
158+
dev_version:
159+
description: "dev_version"
160+
type: string

release-candidates.php

+27
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,26 @@
33
include_once __DIR__ . '/include/prepend.inc';
44
include_once __DIR__ . '/include/release-qa.php';
55

6+
if (isset($_GET["format"])) {
7+
$output = $QA_RELEASES;
8+
9+
if (($_GET['only'] ?? null) === 'dev_versions') {
10+
$output = $output['reported'];
11+
}
12+
13+
switch ($_GET['format'] ?? null) {
14+
case 'json':
15+
header('Content-Type: application/json; charset=UTF-8');
16+
echo json_encode($output);
17+
exit;
18+
case 'serialize':
19+
default:
20+
header('Content-Type: text/plain; charset=UTF-8');
21+
echo serialize($output);
22+
exit;
23+
}
24+
}
25+
626
$SITE_UPDATE = date("D M d H:i:s Y T", filectime(__FILE__));
727

828
$SIDEBAR_DATA = '
@@ -17,6 +37,13 @@
1737
builds, please file a report on <a
1838
href="https://github.com/php/php-src/issues/">GitHub Issues</a>.
1939
</div>
40+
<div class="body">
41+
<p>The QA API is simple, and is based on the query string. Pass in <code>only=dev-versions</code> (the only type currently), along with the desired format (<code>serialize</code> or <code>json</code>).</p>
42+
<ul>
43+
<li>All information, serialized: https://php.net/release-candidates.php?format=serialize</li>
44+
<li>Only dev version numbers, json: https://php.net/release-candidates.php?format=json&only=dev_versions</li>
45+
</ul>
46+
</div>
2047
</div>
2148
';
2249

0 commit comments

Comments
 (0)