|
| 1 | +<?php |
| 2 | + |
| 3 | +/* |
| 4 | +What this file does: |
| 5 | + - Generates the download links found at qa.php.net |
| 6 | + - Determines which test results are emailed to news.php.net/php.qa.reports |
| 7 | + - Defines $QA_RELEASES for internal and external (api.php) use, contains all qa related information for future PHP releases |
| 8 | +
|
| 9 | +Documentation: |
| 10 | + $QA_RELEASES documentation: |
| 11 | + Configuration: |
| 12 | + - Key is future PHP version number |
| 13 | + - Example: If 5.3.6 is the latest stable release, then use 5.3.7 because 5.3.7-dev is our qa version |
| 14 | + - Typically, this is the only part needing changed |
| 15 | + - active (bool): |
| 16 | + - It's active and being tested here |
| 17 | + - Meaning, the version will be reported to the qa.reports list, and be linked at qa.php.net |
| 18 | + - File extensions .tar.gz and .tar.bz2 are assumed to be available |
| 19 | + - release (array): |
| 20 | + - type: RC, alpha, and beta are examples (case should match filename case) |
| 21 | + - version: 0 if no such release exists, otherwise an integer of the rc/alpha/beta number |
| 22 | + - sha256_bz2: sha256 checksum of this downloadable .tar.bz2 file |
| 23 | + - sha256_gz: sha256 checksum of this downloadable .tar.gz file |
| 24 | + - sha256_xz: sha256 checksum of this downloadble .xz file |
| 25 | + - date: date of release e.g., 21 May 2011 |
| 26 | + - baseurl: base url of where these downloads are located |
| 27 | + - Multiple checksums can be available, see the $QA_CHECKSUM_TYPES array below |
| 28 | + Other variables within $QA_RELEASES are later defined including: |
| 29 | + - reported: versions that make it to the qa.reports mailing list |
| 30 | + - release: all current qa releases, including paths to dl urls (w/ sha256 info) |
| 31 | + - dev_version: dev version |
| 32 | + - $QA_RELEASES is made available at qa.php.net/api.php |
| 33 | +
|
| 34 | +TODO: |
| 35 | + - Save all reports (on qa server) for all tests, categorize by PHP version (see buildtest-process.php) |
| 36 | + - Consider storing rc downloads at one location, independent of release master |
| 37 | + - Determine best way to handle rc baseurl, currently assumes .tar.gz/tar.bz2 will exist |
| 38 | + - Determine if $QA_RELEASES is compatible with all current, and most future configurations |
| 39 | + - Determine if $QA_RELEASES can be simplified |
| 40 | + - Determine if alpha/beta options are desired |
| 41 | + - Unify then create defaults for most settings |
| 42 | + - Add option to allow current releases (e.g., retrieve current release info via daily cron, cache, check, configure ~ALLOW_CURRENT_RELEASES) |
| 43 | +*/ |
| 44 | + |
| 45 | + |
| 46 | +$QA_RELEASES = [ |
| 47 | + |
| 48 | + '8.1.27' => [ |
| 49 | + 'active' => true, |
| 50 | + 'release' => [ |
| 51 | + 'type' => 'RC', |
| 52 | + 'number' => 0, |
| 53 | + 'sha256_gz' => '', |
| 54 | + 'sha256_bz2' => '', |
| 55 | + 'sha256_xz' => '', |
| 56 | + 'date' => '07 Nov 2023', |
| 57 | + 'baseurl' => 'https://downloads.php.net/', |
| 58 | + ], |
| 59 | + ], |
| 60 | + |
| 61 | + '8.2.27' => [ |
| 62 | + 'active' => true, |
| 63 | + 'release' => [ |
| 64 | + 'type' => 'RC', |
| 65 | + 'number' => 0, |
| 66 | + 'sha256_bz2' => '', |
| 67 | + 'sha256_gz' => '', |
| 68 | + 'sha256_xz' => '', |
| 69 | + 'date' => '05 Dec 2024', |
| 70 | + 'baseurl' => 'https://downloads.php.net/', |
| 71 | + ], |
| 72 | + ], |
| 73 | + |
| 74 | + '8.3.20' => [ |
| 75 | + 'active' => true, |
| 76 | + 'release' => [ |
| 77 | + 'type' => 'RC', |
| 78 | + 'number' => 0, |
| 79 | + 'sha256_bz2' => '', |
| 80 | + 'sha256_gz' => '', |
| 81 | + 'sha256_xz' => '', |
| 82 | + 'date' => '27 Mar 2025', |
| 83 | + 'baseurl' => 'https://downloads.php.net/', |
| 84 | + ], |
| 85 | + ], |
| 86 | + |
| 87 | + '8.4.7' => [ |
| 88 | + 'active' => true, |
| 89 | + 'release' => [ |
| 90 | + 'type' => 'RC', |
| 91 | + 'number' => 1, |
| 92 | + 'sha256_bz2' => 'acddb1da1b128f984df01347c907a64939f316d7d9bd138b49106f4179b7776f', |
| 93 | + 'sha256_gz' => 'b12d97767aeda4624ea1904c1d93303efe4ffe1ba91970a3c5774ad556918e93', |
| 94 | + 'sha256_xz' => '6cb37632eb65ee311cb4427ad070b6ab27fdaf13e8f0103701b2b78907326c93', |
| 95 | + 'date' => '24 Apr 2025', |
| 96 | + 'baseurl' => 'https://downloads.php.net/~saki/', |
| 97 | + ], |
| 98 | + ], |
| 99 | +]; |
| 100 | + |
| 101 | +/*** End Configuration *******************************************************************/ |
| 102 | + |
| 103 | +// This is a list of the possible checksum values that can be supplied with a QA release. Any |
| 104 | +// new algorithm is read from the $QA_RELEASES array under the 'release' index for each version |
| 105 | +// in the form of "$algorithm_$filetype". |
| 106 | +// |
| 107 | +// For example, if SHA512 were to be supported, the following indices would have to be added: |
| 108 | +// |
| 109 | +// 'sha512_bz2' => 'xxx', |
| 110 | +// 'sha512_gz' => 'xxx', |
| 111 | +// 'sha512_xz' => 'xxx', |
| 112 | +$QA_CHECKSUM_TYPES = ['sha256']; |
| 113 | + |
| 114 | +// $QA_RELEASES eventually contains just about everything, also for external use |
| 115 | +// release : These are encouraged for use (e.g., linked at qa.php.net) |
| 116 | +// reported : These are allowed to report @ the php.qa.reports mailing list |
| 117 | + |
| 118 | +(function(&$QA_RELEASES) use ($QA_CHECKSUM_TYPES) { |
| 119 | + foreach ($QA_RELEASES as $pversion => $info) { |
| 120 | + |
| 121 | + if (isset($info['active']) && $info['active']) { |
| 122 | + |
| 123 | + // Allow -dev versions of all active types |
| 124 | + // Example: 5.3.6-dev |
| 125 | + $QA_RELEASES['reported'][] = "{$pversion}-dev"; |
| 126 | + $QA_RELEASES[$pversion]['dev_version'] = "{$pversion}-dev"; |
| 127 | + |
| 128 | + // Allow -dev version of upcoming qa releases (rc/alpha/beta) |
| 129 | + // @todo confirm this php version format for all dev versions |
| 130 | + if ((int)$info['release']['number'] > 0) { |
| 131 | + $QA_RELEASES['reported'][] = "{$pversion}{$info['release']['type']}{$info['release']['number']}"; |
| 132 | + if (!empty($info['release']['baseurl'])) { |
| 133 | + |
| 134 | + // php.net filename format for qa releases |
| 135 | + // example: php-5.3.0RC2 |
| 136 | + $fn_base = 'php-' . $pversion . $info['release']['type'] . $info['release']['number']; |
| 137 | + |
| 138 | + $QA_RELEASES[$pversion]['release']['version'] = $pversion . $info['release']['type'] . $info['release']['number']; |
| 139 | + foreach ([ 'bz2', 'gz', 'xz' ] as $file_type) { |
| 140 | + foreach ($QA_CHECKSUM_TYPES as $algo) { |
| 141 | + if (isset($info['release'][$algo . '_' . $file_type])) { |
| 142 | + $QA_RELEASES[$pversion]['release']['files'][$file_type][$algo] = $info['release'][$algo . '_' . $file_type]; |
| 143 | + } |
| 144 | + } |
| 145 | + if (!empty($QA_RELEASES[$pversion]['release']['files'][$file_type])) { |
| 146 | + $QA_RELEASES[$pversion]['release']['files'][$file_type]['path']= $info['release']['baseurl'] . $fn_base . '.tar.' . $file_type; |
| 147 | + } |
| 148 | + } |
| 149 | + |
| 150 | + if (empty($QA_RELEASES[$pversion]['release']['files'])) { |
| 151 | + $QA_RELEASES[$pversion]['release']['enabled'] = false; |
| 152 | + } |
| 153 | + } |
| 154 | + } else { |
| 155 | + $QA_RELEASES[$pversion]['release']['enabled'] = false; |
| 156 | + } |
| 157 | + |
| 158 | + } |
| 159 | + } |
| 160 | + |
| 161 | + // Sorted information for later use |
| 162 | + // @todo need these? |
| 163 | + // $QA_RELEASES['releases'] : All current versions with active qa releases |
| 164 | + foreach ($QA_RELEASES as $pversion => $info) { |
| 165 | + if (isset($info['active']) && $info['active'] && !empty($info['release']['number'])) { |
| 166 | + $QA_RELEASES['releases'][$pversion] = $info['release']; |
| 167 | + } |
| 168 | + } |
| 169 | + |
| 170 | +})($QA_RELEASES); |
0 commit comments