9 changed files with 10616 additions and 161 deletions
|
@ -0,0 +1,380 @@
|
||||
<?php |
||||
include_spip('include/releases'); |
||||
include_spip('include/version'); |
||||
|
||||
/* Branch overrides. For situations where we've changed the exact dates for a |
||||
* branch's active support and security fix EOLs, these can be reflected here. |
||||
* |
||||
* Supported keys are: |
||||
* - stable: the end of active support (usually two years after release). |
||||
* - security: the end of security support (usually release + 3 years). |
||||
*/ |
||||
$BRANCHES = array( |
||||
/* 3.0 is here because version_compare() can't handle the only version in |
||||
* $OLDRELEASES, and it saves another special case in |
||||
* get_branch_security_eol_date(). */ |
||||
'3.0' => array( |
||||
'security' => '2000-10-20', |
||||
), |
||||
'5.3' => array( |
||||
'stable' => '2013-07-11', |
||||
'security' => '2014-08-14', |
||||
), |
||||
'5.4' => array( |
||||
'stable' => '2014-09-14', |
||||
'security' => '2015-09-03', |
||||
), |
||||
'5.5' => array( |
||||
'stable' => '2015-07-10', |
||||
'security' => '2016-07-21', |
||||
), |
||||
'5.6' => array( |
||||
'stable' => '2017-01-19', |
||||
'security' => '2018-12-31', |
||||
), |
||||
'7.0' => array( |
||||
'stable' => '2018-01-04', |
||||
'security' => '2019-01-10', |
||||
), |
||||
); |
||||
|
||||
/* Time to keep EOLed branches in the array returned by get_active_branches(), |
||||
* which is used on the front page download links and the supported versions |
||||
* page. (Currently 28 days.) */ |
||||
$KEEP_EOL = new DateInterval('P28D'); |
||||
|
||||
function format_interval($from, $to) { |
||||
try { |
||||
$from_obj = $from instanceof DateTime ? $from : new DateTime($from); |
||||
$to_obj = $to instanceof DateTime ? $to : new DateTime($to); |
||||
$diff = $to_obj->diff($from_obj); |
||||
|
||||
$times = array(); |
||||
if ($diff->y) { |
||||
$times[] = array($diff->y,'year'); |
||||
if ($diff->m) { |
||||
$times[] = array($diff->m,'month'); |
||||
} |
||||
} elseif ($diff->m) { |
||||
$times[] = array($diff->m,'month'); |
||||
} elseif ($diff->d) { |
||||
$times[] = array($diff->d,'day'); |
||||
} else { |
||||
$eolPeriod = 'midnight'; |
||||
} |
||||
if ($times) { |
||||
$eolPeriod = implode( |
||||
', ', |
||||
array_map( |
||||
function ($t) { |
||||
return "$t[0] $t[1]" . |
||||
($t[0] != 1 ? 's' : ''); |
||||
}, |
||||
$times |
||||
) |
||||
); |
||||
|
||||
if ($diff->invert) { |
||||
$eolPeriod = "$eolPeriod ago"; |
||||
} else { |
||||
$eolPeriod = "in $eolPeriod"; |
||||
} |
||||
} |
||||
} catch (Exception $e) { |
||||
$eolPeriod = 'unknown'; |
||||
} |
||||
|
||||
return $eolPeriod; |
||||
} |
||||
|
||||
function version_number_to_branch($version) { |
||||
$parts = explode('.', $version); |
||||
if (count($parts) > 1) { |
||||
return "$parts[0].$parts[1]"; |
||||
} |
||||
} |
||||
|
||||
function get_all_branches() { |
||||
$branches = array(); |
||||
|
||||
foreach ($GLOBALS['OLDRELEASES'] as $major => $releases) { |
||||
foreach ($releases as $version => $release) { |
||||
if ($branch = version_number_to_branch($version)) { |
||||
if (!isset($branches[$major][$branch]) || version_compare($version, $branches[$major][$branch]['version'], 'gt')) { |
||||
$branches[$major][$branch] = $release; |
||||
$branches[$major][$branch]['version'] = $version; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
foreach ($GLOBALS['RELEASES'] as $major => $releases) { |
||||
foreach ($releases as $version => $release) { |
||||
if ($branch = version_number_to_branch($version)) { |
||||
if (!isset($branches[$major][$branch]) || version_compare($version, $branches[$major][$branch]['version'], 'gt')) { |
||||
$branches[$major][$branch] = $release; |
||||
$branches[$major][$branch]['version'] = $version; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
krsort($branches); |
||||
foreach ($branches as $major => &$branch) { |
||||
krsort($branch); |
||||
} |
||||
|
||||
return $branches; |
||||
} |
||||
|
||||
function get_active_branches($include_recent_eols = true) { |
||||
$branches = array(); |
||||
$now = new DateTime; |
||||
|
||||
foreach ($GLOBALS['RELEASES'] as $major => $releases) { |
||||
foreach ($releases as $version => $release) { |
||||
if ($branch = version_number_to_branch($version)) { |
||||
$threshold = get_branch_security_eol_date($branch); |
||||
if ($include_recent_eols) { |
||||
$threshold->add($GLOBALS['KEEP_EOL']); |
||||
} |
||||
if ($now < $threshold) { |
||||
$branches[$major][$branch] = $release; |
||||
$branches[$major][$branch]['version'] = $version; |
||||
} |
||||
} |
||||
} |
||||
if (!empty($branches[$major])) { |
||||
ksort($branches[$major]); |
||||
} |
||||
} |
||||
|
||||
ksort($branches); |
||||
return $branches; |
||||
} |
||||
|
||||
/* If you provide an array to $always_include, note that the version numbers |
||||
* must be in $RELEASES _and_ must be the full version number, not the branch: |
||||
* ie provide array('5.3.29'), not array('5.3'). */ |
||||
function get_eol_branches($always_include = null) { |
||||
$always_include = $always_include ? $always_include : array(); |
||||
$branches = array(); |
||||
$now = new DateTime; |
||||
|
||||
// Gather the last release on each branch into a convenient array. |
||||
foreach ($GLOBALS['OLDRELEASES'] as $major => $releases) { |
||||
foreach ($releases as $version => $release) { |
||||
if ($branch = version_number_to_branch($version)) { |
||||
if (!isset($branches[$major][$branch]) || version_compare($version, $branches[$major][$branch]['version'], 'gt')) { |
||||
$branches[$major][$branch] = array( |
||||
'date' => strtotime($release['date']), |
||||
'link' => "/releases#$version", |
||||
'version' => $version, |
||||
); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
/* Exclude releases from active branches, where active is defined as "in |
||||
* the $RELEASES array and not explicitly marked as EOL there". */ |
||||
foreach ($GLOBALS['RELEASES'] as $major => $releases) { |
||||
foreach ($releases as $version => $release) { |
||||
if ($branch = version_number_to_branch($version)) { |
||||
if ($now < get_branch_security_eol_date($branch)) { |
||||
/* This branch isn't EOL: remove it from our array. */ |
||||
if (isset($branches[$major][$branch])) { |
||||
unset($branches[$major][$branch]); |
||||
} |
||||
} else { |
||||
/* Add the release information to the EOL branches array, since it |
||||
* should be newer than the information we got from $OLDRELEASES. */ |
||||
$always_include[] = $version; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
// Include any release in the always_include list that's in $RELEASES. |
||||
if ($always_include) { |
||||
foreach ($always_include as $version) { |
||||
$parts = explode('.', $version); |
||||
$major = $parts[0]; |
||||
|
||||
if (isset($GLOBALS['RELEASES'][$major][$version])) { |
||||
$release = $GLOBALS['RELEASES'][$major][$version]; |
||||
if ($branch = version_number_to_branch($version)) { |
||||
$branches[$major][$branch] = array( |
||||
'date' => strtotime($release['source'][0]['date']), |
||||
'link' => "/downloads#v$version", |
||||
'version' => $version, |
||||
); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
krsort($branches); |
||||
foreach ($branches as $major => &$branch) { |
||||
krsort($branch); |
||||
} |
||||
|
||||
return $branches; |
||||
} |
||||
|
||||
/* $branch is expected to have at least two components: MAJOR.MINOR or |
||||
* MAJOR.MINOR.REVISION (the REVISION will be ignored if provided). This will |
||||
* return either null (if no release exists on the given branch), or the usual |
||||
* version metadata from $RELEASES for a single release. */ |
||||
function get_initial_release($branch) { |
||||
$branch = version_number_to_branch($branch); |
||||
if (!$branch) { |
||||
return null; |
||||
} |
||||
$major = substr($branch, 0, strpos($branch, '.')); |
||||
|
||||
if (isset($GLOBALS['OLDRELEASES'][$major]["$branch.0"])) { |
||||
return $GLOBALS['OLDRELEASES'][$major]["$branch.0"]; |
||||
} |
||||
|
||||
/* If there's only been one release on the branch, it won't be in |
||||
* $OLDRELEASES yet, so let's check $RELEASES. */ |
||||
if (isset($GLOBALS['RELEASES'][$major]["$branch.0"])) { |
||||
// Fake a date like we have on the oldreleases array. |
||||
$release = $GLOBALS['RELEASES'][$major]["$branch.0"]; |
||||
$release['date'] = $release['source'][0]['date']; |
||||
return $release; |
||||
} |
||||
|
||||
// Shrug. |
||||
return null; |
||||
} |
||||
|
||||
function get_final_release($branch) { |
||||
$branch = version_number_to_branch($branch); |
||||
if (!$branch) { |
||||
return null; |
||||
} |
||||
$major = substr($branch, 0, strpos($branch, '.')); |
||||
|
||||
$last = "$branch.0"; |
||||
foreach ($GLOBALS['OLDRELEASES'][$major] as $version => $release) { |
||||
if (version_number_to_branch($version) == $branch && version_compare($version, $last, '>')) { |
||||
$last = $version; |
||||
} |
||||
} |
||||
|
||||
if (isset($GLOBALS['OLDRELEASES'][$major][$last])) { |
||||
return $GLOBALS['OLDRELEASES'][$major][$last]; |
||||
} |
||||
|
||||
/* If there's only been one release on the branch, it won't be in |
||||
* $OLDRELEASES yet, so let's check $RELEASES. */ |
||||
if (isset($GLOBALS['RELEASES'][$major][$last])) { |
||||
// Fake a date like we have on the oldreleases array. |
||||
$release = $GLOBALS['RELEASES'][$major][$last]; |
||||
$release['date'] = $release['source'][0]['date']; |
||||
return $release; |
||||
} |
||||
|
||||
// Shrug. |
||||
return null; |
||||
} |
||||
|
||||
function get_branch_bug_eol_date($branch) { |
||||
if (isset($GLOBALS['BRANCHES'][$branch]['stable'])) { |
||||
return new DateTime($GLOBALS['BRANCHES'][$branch]['stable']); |
||||
} |
||||
|
||||
$date = get_branch_release_date($branch); |
||||
|
||||
return $date ? $date->add(new DateInterval('P2Y')) : null; |
||||
} |
||||
|
||||
function get_branch_security_eol_date($branch) { |
||||
if (isset($GLOBALS['BRANCHES'][$branch]['security'])) { |
||||
return new DateTime($GLOBALS['BRANCHES'][$branch]['security']); |
||||
} |
||||
|
||||
/* Versions before 5.3 are based solely on the final release date in |
||||
* $OLDRELEASES. */ |
||||
if (version_compare($branch, '5.3', '<')) { |
||||
$release = get_final_release($branch); |
||||
|
||||
return $release ? new DateTime($release['date']) : null; |
||||
} |
||||
|
||||
$date = get_branch_release_date($branch); |
||||
return $date ? $date->add(new DateInterval('P3Y')) : null; |
||||
} |
||||
|
||||
function get_branch_release_date($branch) { |
||||
$initial = get_initial_release($branch); |
||||
|
||||
return $initial ? new DateTime($initial['date']) : null; |
||||
} |
||||
|
||||
function get_branch_support_state($branch) { |
||||
$initial = get_branch_release_date($branch); |
||||
$bug = get_branch_bug_eol_date($branch); |
||||
$security = get_branch_security_eol_date($branch); |
||||
|
||||
if ($initial && $bug && $security) { |
||||
$now = new DateTime; |
||||
|
||||
if ($now >= $security) { |
||||
return 'eol'; |
||||
} elseif ($now >= $bug) { |
||||
return 'security'; |
||||
} elseif ($now >= $initial) { |
||||
return 'stable'; |
||||
} else { |
||||
return 'future'; |
||||
} |
||||
} |
||||
|
||||
return null; |
||||
} |
||||
|
||||
function compare_version($arrayA, $versionB) { |
||||
static $sortValues = array( |
||||
true => 1, |
||||
false => -1, |
||||
); |
||||
|
||||
$length = count($arrayA); |
||||
$arrayB = version_array($versionB, $length); |
||||
|
||||
if (!is_array($arrayA) || !is_array($arrayB)) { |
||||
return $sortValues[$arrayA > $arrayB]; |
||||
} |
||||
|
||||
foreach ($arrayA as $index => $componentA) { |
||||
$componentA = $arrayA[$index]; |
||||
$componentB = $arrayB[$index]; |
||||
if ($componentA != $componentB) { |
||||
return $sortValues[$componentA > $componentB]; |
||||
} |
||||
} |
||||
|
||||
return 0; |
||||
} |
||||
|
||||
function version_array($version, $length = null) { |
||||
$versionArray = array_map( |
||||
'intval', |
||||
explode('.', $version) |
||||
); |
||||
|
||||
if (is_int($length)) { |
||||
$versionArray = count($versionArray) < $length |
||||
? array_pad($versionArray, $length, 0) |
||||
: array_slice( |
||||
$versionArray, |
||||
0, |
||||
$length |
||||
); |
||||
} |
||||
|
||||
return $versionArray; |
||||
} |
@ -0,0 +1,130 @@
|
||||
<?php // vim: et
|
||||
/* The format is: |
||||
* array( |
||||
* "major release number" => array( |
||||
* "release" => array( |
||||
* "source/windows" => array( |
||||
* "filename" => "filename.tar.bz2", |
||||
* "name" => "package name", |
||||
* "sha256" => "shasum -256", |
||||
* "date" => "this files release date", |
||||
* "note" => "this file was updated 29feb due to broken phar files..", |
||||
* ), |
||||
* "announcement" => "bool, release announcement exists in releases/?", |
||||
* ), |
||||
* ), |
||||
* ); |
||||
*/ |
||||
/* PHP 7.3 Release */ |
||||
$PHP_7_3_RC = '7.3.3RC1'; // Current RC version (e.g., '7.3.1RC1') or false |
||||
$PHP_7_3_RC_DATE = '21 Feb 2019'; |
||||
|
||||
$PHP_7_3_VERSION = '7.3.2'; |
||||
$PHP_7_3_DATE = '07 Feb 2019'; |
||||
$PHP_7_3_SHA256 = array( |
||||
'tar.bz2' => '946f50dacbd2f61e643bb737021cbe8b1816e780ee7ad3e0cd999a1892ab0add', |
||||
'tar.gz' => '4597294b00edc1c63a021b6c7838eb43384f62eeb9e392f0b91c38a3c090f499', |
||||
'tar.xz' => '010b868b4456644ae227d05ad236c8b0a1f57dc6320e7e5ad75e86c5baf0a9a8', |
||||
); |
||||
|
||||
/* PHP 7.2 Release */ |
||||
$PHP_7_2_RC = '7.2.16RC1'; // Current RC version (e.g., '7.2.1RC1') or false |
||||
$PHP_7_2_RC_DATE = '21 Feb 2019'; |
||||
|
||||
$PHP_7_2_VERSION = '7.2.15'; |
||||
$PHP_7_2_DATE = '07 Feb 2019'; |
||||
$PHP_7_2_SHA256 = array( |
||||
'tar.bz2' => 'c93e7616946a463911818c7e9f9e21276c7793fb8c7cb15877188dd0546d0554', |
||||
'tar.gz' => '9b13bde9f5a32d6f6bdb8b911bb55bb818d0c4073538f8dc48aa2deb560f55a3', |
||||
'tar.xz' => '75e90012faef700dffb29311f3d24fa25f1a5e0f70254a9b8d5c794e25e938ce', |
||||
); |
||||
|
||||
/* PHP 7.1 Release */ |
||||
$PHP_7_1_RC = false; // Current RC version (e.g., '5.6.7RC1') or false |
||||
$PHP_7_1_RC_DATE = '25 Oct 2018'; |
||||
|
||||
$PHP_7_1_VERSION = '7.1.26'; |
||||
$PHP_7_1_DATE = '10 Jan 2019'; |
||||
$PHP_7_1_SHA256 = array( |
||||
'tar.bz2' => '5b351ca86bc7e4600778aaf1d61ab9e4e38864efa86ab4cc4d5b02ea7f542ae6', |
||||
'tar.gz' => '069315d3c3f964fd165bbbb3c2fc56005813e2cf97bed05055318dcc4e775328', |
||||
'tar.xz' => '10b7ae634c12852fae52a22dc2262e5f12418ad59fd20da2d00d71a212235d31', |
||||
); |
||||
|
||||
$GLOBALS['RELEASES'] = array( |
||||
7 => array( |
||||
$PHP_7_3_VERSION => array( |
||||
'announcement' => true, |
||||
'source' => array( |
||||
array( |
||||
'filename' => "php-$PHP_7_3_VERSION.tar.bz2", |
||||
'name' => "PHP $PHP_7_3_VERSION (tar.bz2)", |
||||
'sha256' => $PHP_7_3_SHA256['tar.bz2'], |
||||
'date' => $PHP_7_3_DATE, |
||||
), |
||||
array( |
||||
'filename' => "php-$PHP_7_3_VERSION.tar.gz", |
||||
'name' => "PHP $PHP_7_3_VERSION (tar.gz)", |
||||
'sha256' => $PHP_7_3_SHA256['tar.gz'], |
||||
'date' => $PHP_7_3_DATE, |
||||
), |
||||
array( |
||||
'filename' => "php-$PHP_7_3_VERSION.tar.xz", |
||||
'name' => "PHP $PHP_7_3_VERSION (tar.xz)", |
||||
'sha256' => $PHP_7_3_SHA256['tar.xz'], |
||||
'date' => $PHP_7_3_DATE, |
||||
), |
||||
), |
||||
), |
||||
$PHP_7_2_VERSION => array( |
||||
'announcement' => true, |
||||
'source' => array( |
||||
array( |
||||
'filename' => "php-$PHP_7_2_VERSION.tar.bz2", |
||||
'name' => "PHP $PHP_7_2_VERSION (tar.bz2)", |
||||
'sha256' => $PHP_7_2_SHA256['tar.bz2'], |
||||
'date' => $PHP_7_2_DATE, |
||||
), |
||||
array( |
||||
'filename' => "php-$PHP_7_2_VERSION.tar.gz", |
||||
'name' => "PHP $PHP_7_2_VERSION (tar.gz)", |
||||
'sha256' => $PHP_7_2_SHA256['tar.gz'], |
||||
'date' => $PHP_7_2_DATE, |
||||
), |
||||
array( |
||||
'filename' => "php-$PHP_7_2_VERSION.tar.xz", |
||||
'name' => "PHP $PHP_7_2_VERSION (tar.xz)", |
||||
'sha256' => $PHP_7_2_SHA256['tar.xz'], |
||||
'date' => $PHP_7_2_DATE, |
||||
), |
||||
), |
||||
), |
||||
$PHP_7_1_VERSION => array( |
||||
'announcement' => true, |
||||
'source' => array( |
||||
array( |
||||
'filename' => "php-$PHP_7_1_VERSION.tar.bz2", |
||||
'name' => "PHP $PHP_7_1_VERSION (tar.bz2)", |
||||
'sha256' => $PHP_7_1_SHA256['tar.bz2'], |
||||
'date' => $PHP_7_1_DATE, |
||||
), |
||||
array( |
||||
'filename' => "php-$PHP_7_1_VERSION.tar.gz", |
||||
'name' => "PHP $PHP_7_1_VERSION (tar.gz)", |
||||
'sha256' => $PHP_7_1_SHA256['tar.gz'], |
||||
'date' => $PHP_7_1_DATE, |
||||
), |
||||
array( |
||||
'filename' => "php-$PHP_7_1_VERSION.tar.xz", |
||||
'name' => "PHP $PHP_7_1_VERSION (tar.xz)", |
||||
'sha256' => $PHP_7_1_SHA256['tar.xz'], |
||||
'date' => $PHP_7_1_DATE, |
||||
), |
||||
), |
||||
), |
||||
), |
||||
); |
||||
|
||||
$PHP_7_VERSION = $PHP_7_3_VERSION; // Some scripts require this set |
||||
$PHP_7_DATE = $PHP_7_3_DATE; // Used by bumpRelease script |
||||
$PHP_7_RC_DATE = $PHP_7_3_RC_DATE; // Used by master |
Before Width: | Height: | Size: 448 B After Width: | Height: | Size: 3.7 KiB |
@ -1,37 +1,25 @@
|
||||
<B_active_branches> |
||||
<table class="standard"> |
||||
<thead> |
||||
<tr> |
||||
<thead> |
||||
<tr> |
||||
<th>Branch</th> |
||||
<th colspan="2">Initial Release</th> |
||||
<th colspan="2">Active Support Until</th> |
||||
<th colspan="2">Security Support Until</th> |
||||
</tr> |
||||
</thead> |
||||
<tbody> |
||||
<?php foreach (get_active_branches(false) as $major => $releases): ?> |
||||
<?php ksort($releases) ?> |
||||
<?php foreach ($releases as $branch => $release): ?> |
||||
<?php |
||||
$state = get_branch_support_state($branch); |
||||
$initial = get_branch_release_date($branch); |
||||
$until = get_branch_bug_eol_date($branch); |
||||
$eol = get_branch_security_eol_date($branch); |
||||
?> |
||||
<tr class="<?php echo $state ?>"> |
||||
<td> |
||||
<a href="/downloads.php#v<?php echo htmlspecialchars($release['version']) ?>"><?php echo htmlspecialchars($branch) ?></a> |
||||
<?php if (isset($VERSION_NOTES[$branch])): ?> |
||||
<a class="version-notes" href="<?php echo htmlspecialchars($VERSION_NOTES[$branch]) ?>">*</a> |
||||
<?php endif ?> |
||||
</td> |
||||
<td><?php echo htmlspecialchars($initial->format('j M Y')) ?></td> |
||||
<td class="collapse-phone"><em><?php echo htmlspecialchars(format_interval($initial, null)) ?></em></td> |
||||
<td><?php echo htmlspecialchars($until->format('j M Y')) ?></td> |
||||
<td class="collapse-phone"><em><?php echo htmlspecialchars(format_interval($until, null)) ?></em></td> |
||||
<td><?php echo htmlspecialchars($eol->format('j M Y')) ?></td> |
||||
<td class="collapse-phone"><em><?php echo htmlspecialchars(format_interval($eol, null)) ?></em></td> |
||||
</tr> |
||||
<?php endforeach ?> |
||||
<?php endforeach ?> |
||||
</tbody> |
||||
</tr> |
||||
</thead> |
||||
<tbody> |
||||
<BOUCLE_active_branches(DATA){source csv, #CHEMIN{data/releases.csv}}{1,n}> |
||||
<tr> |
||||
<td class="[(#VALEUR|state)]">#BRANCH</td> |
||||
<td>[(#INITIAL_RELEASE|affdate)]</td> |
||||
<td class="collapse-phone">[<em>(#INITIAL_RELEASE|date_relative)</em>]</td> |
||||
<td>[(#ACTIVE_SUPPORT|affdate)]</td> |
||||
<td class="collapse-phone">[<em>(#ACTIVE_SUPPORT|date_relative)</em>]</td> |
||||
<td>[(#EOL|affdate)]</td> |
||||
<td class="collapse-phone">[<em>(#EOL|date_relative)</em>]</td> |
||||
</tr> |
||||
</BOUCLE_active_branches> |
||||
</tbody> |
||||
</table> |
||||
</B_active_branches> |
||||
|
Loading…
Reference in new issue