Author: Sergey Panteleev (saundefined)
Committer: GitHub (web-flow)
Pusher: saundefined
Date: 2025-04-25T15:55:57+03:00

Commit: 
https://github.com/php/web-php/commit/3a4890869ac9d7c031b6070083262e91d9a333fa
Raw diff: 
https://github.com/php/web-php/commit/3a4890869ac9d7c031b6070083262e91d9a333fa.diff

Add API for QA (#1262)

Changed paths:
  M  openapi.yml
  M  release-candidates.php


Diff:

diff --git a/openapi.yml b/openapi.yml
index 5d2d6da9cd..babc00c64d 100644
--- a/openapi.yml
+++ b/openapi.yml
@@ -92,3 +92,69 @@ paths:
                                             type: string
                                             format: date-time
 
+    "/release-candidates.php":
+        get:
+            summary: "Currently RC versions of PHP."
+            parameters:
+                - in: query
+                  name: format
+                  schema:
+                      type: string
+                      enum: [ "json", "serialize" ]
+                  required: false
+                  description: Output format
+                - in: query
+                  name: only
+                  schema:
+                      type: string
+                      enum: [ "dev_versions" ]
+                  required: false
+                  description: Include only dev version numbers
+
+            responses:
+                "200":
+                    description: "Actively RC per-branch versions of PHP."
+                    content:
+                        "application/json":
+                            schema:
+                                type: array
+                                items:
+                                    type: object
+                                    properties:
+                                        active:
+                                            description: "Whether RC version 
is active"
+                                            type: boolean
+                                        release:
+                                            type: object
+                                            properties:
+                                                type:
+                                                    description: "Unstable 
release type"
+                                                    type: string
+                                                    enum:
+                                                        - alpha
+                                                        - beta
+                                                        - RC
+                                                number:
+                                                    description: "Unstable 
release number"
+                                                    type: integer
+                                                sha256_gz:
+                                                    description: "Unstable 
release gz hash"
+                                                    type: string
+                                                sha256_bz2:
+                                                    description: "Unstable 
release bz2 hash"
+                                                    type: string
+                                                sha256_xz:
+                                                    description: "Unstable 
release xz hash"
+                                                    type: string
+                                                date:
+                                                    description: "Date of 
release"
+                                                    type: string
+                                                baseurl:
+                                                    description: "Download 
base URL"
+                                                    type: string
+                                                enabled:
+                                                    description: "enabled"
+                                                    type: boolean
+                                        dev_version:
+                                            description: "dev_version"
+                                            type: string
diff --git a/release-candidates.php b/release-candidates.php
index d3a6c46432..3985861f77 100644
--- a/release-candidates.php
+++ b/release-candidates.php
@@ -3,6 +3,26 @@
 include_once __DIR__ . '/include/prepend.inc';
 include_once __DIR__ . '/include/release-qa.php';
 
+if (isset($_GET["format"])) {
+    $output = $QA_RELEASES;
+
+    if (($_GET['only'] ?? null) === 'dev_versions') {
+        $output = $output['reported'];
+    }
+
+    switch ($_GET['format'] ?? null) {
+        case 'json':
+            header('Content-Type: application/json; charset=UTF-8');
+            echo json_encode($output);
+            exit;
+        case 'serialize':
+        default:
+            header('Content-Type: text/plain; charset=UTF-8');
+            echo serialize($output);
+            exit;
+    }
+}
+
 $SITE_UPDATE = date("D M d H:i:s Y T", filectime(__FILE__));
 
 $SIDEBAR_DATA = '
@@ -17,6 +37,13 @@
     builds, please file a report on <a
     href="https://github.com/php/php-src/issues/";>GitHub Issues</a>.
   </div>
+  <div class="body">
+    <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>
+    <ul>
+        <li>All information, serialized: 
https://php.net/release-candidates.php?format=serialize</li>
+        <li>Only dev version numbers, json: 
https://php.net/release-candidates.php?format=json&only=dev_versions</li>
+    </ul>
+  </div>
 </div>
 ';
 

Reply via email to