Browse Source

tests et modele table

merge-requests/1/head
JamesRezo 4 years ago
parent
commit
cc278265cc
  1. 8
      data/releases.csv
  2. 380
      inc/branches.php
  3. 9956
      inc/releases.php
  4. 113
      inc/supported-versions.php
  5. 130
      inc/version.php
  6. 15
      lang/supportedversions_fr.php
  7. 115
      modeles/supported-versions.html
  8. 50
      modeles/table.html
  9. 10
      supportedversions_fonctions.php

8
data/releases.csv

@ -0,0 +1,8 @@
branch,initial_release,active_support,eol
1.8,2005-04-01,2010-04-09,2010-04-09
1.9,2006-07-01,2012-05-12,2012-05-12
2.0,2008-12-12,2016-01-06,2016-01-06
2.1,2010-04-09,2017-10-17,2017-10-17
3.0,2012-05-12,2017-10-17,2019-06-30
3.1,2016-01-06,2019-06-30,
3.2,2017-10-17,,
1 branch initial_release active_support eol
2 1.8 2005-04-01 2010-04-09 2010-04-09
3 1.9 2006-07-01 2012-05-12 2012-05-12
4 2.0 2008-12-12 2016-01-06 2016-01-06
5 2.1 2010-04-09 2017-10-17 2017-10-17
6 3.0 2012-05-12 2017-10-17 2019-06-30
7 3.1 2016-01-06 2019-06-30
8 3.2 2017-10-17

380
inc/branches.php

@ -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;
}

9956
inc/releases.php

File diff suppressed because it is too large Load Diff

113
inc/supported-versions.php

@ -1,6 +1,6 @@
<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/prepend.inc';
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/branches.inc';
include_spip('inc/branches');
// Sizing constants.
$margin_left = 80;
@ -51,115 +51,6 @@ foreach ($branches as $branch => $version) {
$branches[$branch]['top'] = $header_height + ($branch_height * $i++);
}
if (!isset($non_standalone)) {
header('Content-Type: image/svg+xml');
echo '<?xml version="1.0"?>';
}
$years = iterator_to_array(new DatePeriod(min_date(), new DateInterval('P1Y'), max_date()));
$width = $margin_left + $margin_right + ((count($years) - 1) * $year_width);
$height = $header_height + $footer_height + (count($branches) * $branch_height);
?>
<svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 <?php echo $width ?> <?php echo $height ?>" width="<?php echo $width ?>" height="<?php echo $height ?>">
<style type="text/css">
<![CDATA[
@import url(/fonts/Fira/fira.css);
text {
fill: #333;
font-family: "Fira Sans", "Source Sans Pro", Helvetica, Arial, sans-serif;
font-size: <?php echo (2 / 3) * $header_height; ?>px;
}
g.eol rect,
.branches rect.eol {
fill: #f33;
}
g.eol text {
fill: white;
}
g.security rect,
.branches rect.security {
fill: #f93;
}
g.stable rect,
.branches rect.stable {
fill: #9c9;
}
.branch-labels text {
dominant-baseline: central;
text-anchor: middle;
}
.today line {
stroke: #f33;
stroke-dasharray: 7,7;
stroke-width: 3px;
}
.today text {
fill: #f33;
text-anchor: middle;
}
.years line {
stroke: black;
}
.years text {
text-anchor: middle;
}
]]>
</style>
<!-- Branch labels -->
<g class="branch-labels">
<?php foreach ($branches as $branch => $version): ?>
<g class="<?php echo get_branch_support_state($branch) ?>">
<rect x="0" y="<?php echo $version['top'] ?>" width="<?php echo 0.5 * $margin_left ?>" height="<?php echo $branch_height ?>" />
<text x="<?php echo 0.25 * $margin_left ?>" y="<?php echo $version['top'] + (0.5 * $branch_height) ?>">
<?php echo htmlspecialchars($branch) ?>
</text>
</g>
<?php endforeach ?>
</g>
<!-- Branch blocks -->
<g class="branches">
<?php foreach ($branches as $branch => $version): ?>
<?php
$x_release = date_horiz_coord(get_branch_release_date($branch));
$x_bug = date_horiz_coord(get_branch_bug_eol_date($branch));
$x_eol = date_horiz_coord(get_branch_security_eol_date($branch));
?>
<rect class="stable" x="<?php echo $x_release ?>" y="<?php echo $version['top'] ?>" width="<?php echo $x_bug - $x_release ?>" height="<?php echo $branch_height ?>" />
<rect class="security" x="<?php echo $x_bug ?>" y="<?php echo $version['top'] ?>" width="<?php echo $x_eol - $x_bug ?>" height="<?php echo $branch_height ?>" />
<?php endforeach ?>
</g>
<!-- Year lines -->
<g class="years">
<?php foreach ($years as $date): ?>
<line x1="<?php echo date_horiz_coord($date) ?>" y1="<?php echo $header_height ?>" x2="<?php echo date_horiz_coord($date) ?>" y2="<?php echo $header_height + (count($branches) * $branch_height) ?>" />
<text x="<?php echo date_horiz_coord($date) ?>" y="<?php echo 0.8 * $header_height; ?>">
<?php echo $date->format('j M Y') ?>
</text>
<?php endforeach ?>
</g>
<!-- Today -->
<g class="today">
<?php
$now = new DateTime;
$x = date_horiz_coord($now);
?>
<line x1="<?php echo $x ?>" y1="<?php echo $header_height ?>" x2="<?php echo $x ?>" y2="<?php echo $header_height + (count($branches) * $branch_height) ?>" />
<text x="<?php echo $x ?>" y="<?php echo $header_height + (count($branches) * $branch_height) + (0.8 * $footer_height) ?>">
<?php echo 'Today: '.$now->format('j M Y') ?>
</text>
</g>
</svg>

130
inc/version.php

@ -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

15
lang/supportedversions_fr.php

@ -2,13 +2,14 @@
$GLOBALS[$GLOBALS['idx_lang']] = [
'active_support' => 'Active support',
'active_support_definition' => 'A release that is being actively supported.
Reported bugs and security issues are fixed and regular point releases are made.',
'active_support_definition' => 'Une version qui est activement prise en charge.
Les bogues signalés et les problèmes de sécurité sont corrigés
et des mises à jour régulières sont effectuées.',
'security_fix' => 'Security fixes only',
'security_fix_definition' => 'Une version qui est maintenue pour des corrections de failles de sécurité seulement.
Releases are only made on an as-needed basis.',
'security_fix_definition' => 'Une version prise en charge uniquement pour les problèmes de sécurité critiques.
Les publications ne sont effectuées qu\'au besoin.',
'end_of_life' => 'Fin de vie',
'end_of_life_definition' => 'Une version qui n\'est plus maintenue.
Les utilisateurs de cette version devraient faire une mise à jour le plus rapidement possible,
as they may be exposed to unpatched security vulnerabilities.',
'end_of_life_definition' => 'Une version qui n\'est plus prise en charge.
Les utilisateurs de cette version doivent mettre à jour dès que possible,
car ils peuvent être exposés à des vulnérabilités de sécurité non corrigées.',
];

115
modeles/supported-versions.html

@ -1,12 +1,103 @@
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="300" height="200">
<title>Exemple simple de figure SVG</title>
<desc>
Cette figure est constituée d'un rectangle,
d'un segment de droite et d'un cercle.
</desc>
<rect width="100" height="80" x="0" y="70" fill="green" />
<line x1="5" y1="5" x2="250" y2="95" stroke="red" />
<circle cx="90" cy="80" r="50" fill="blue" />
<text x="180" y="60">Un texte</text>
</svg>
<svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 <?php echo $width ?> <?php echo $height ?>" width="<?php echo $width ?>" height="<?php echo $height ?>">
<style type="text/css">
<![CDATA[
@import url(/fonts/Fira/fira.css);
text {
fill: #333;
font-family: "Fira Sans", "Source Sans Pro", Helvetica, Arial, sans-serif;
font-size: <?php echo (2 / 3) * $header_height; ?>px;
}
g.eol rect,
.branches rect.eol {
fill: #f33;
}
g.eol text {
fill: white;
}
g.security rect,
.branches rect.security {
fill: #f93;
}
g.stable rect,
.branches rect.stable {
fill: #9c9;
}
.branch-labels text {
dominant-baseline: central;
text-anchor: middle;
}
.today line {
stroke: #f33;
stroke-dasharray: 7,7;
stroke-width: 3px;
}
.today text {
fill: #f33;
text-anchor: middle;
}
.years line {
stroke: black;
}
.years text {
text-anchor: middle;
}
]]>
</style>
<!-- Branch labels -->
<g class="branch-labels">
<?php foreach ($branches as $branch => $version): ?>
<g class="<?php echo get_branch_support_state($branch) ?>">
<rect x="0" y="<?php echo $version['top'] ?>" width="<?php echo 0.5 * $margin_left ?>" height="<?php echo $branch_height ?>" />
<text x="<?php echo 0.25 * $margin_left ?>" y="<?php echo $version['top'] + (0.5 * $branch_height) ?>">
<?php echo htmlspecialchars($branch) ?>
</text>
</g>
<?php endforeach ?>
</g>
<!-- Branch blocks -->
<g class="branches">
<?php foreach ($branches as $branch => $version): ?>
<?php
$x_release = date_horiz_coord(get_branch_release_date($branch));
$x_bug = date_horiz_coord(get_branch_bug_eol_date($branch));
$x_eol = date_horiz_coord(get_branch_security_eol_date($branch));
?>
<rect class="stable" x="<?php echo $x_release ?>" y="<?php echo $version['top'] ?>" width="<?php echo $x_bug - $x_release ?>" height="<?php echo $branch_height ?>" />
<rect class="security" x="<?php echo $x_bug ?>" y="<?php echo $version['top'] ?>" width="<?php echo $x_eol - $x_bug ?>" height="<?php echo $branch_height ?>" />
<?php endforeach ?>
</g>
<!-- Year lines -->
<g class="years">
<?php foreach ($years as $date): ?>
<line x1="<?php echo date_horiz_coord($date) ?>" y1="<?php echo $header_height ?>" x2="<?php echo date_horiz_coord($date) ?>" y2="<?php echo $header_height + (count($branches) * $branch_height) ?>" />
<text x="<?php echo date_horiz_coord($date) ?>" y="<?php echo 0.8 * $header_height; ?>">
<?php echo $date->format('j M Y') ?>
</text>
<?php endforeach ?>
</g>
<!-- Today -->
<g class="today">
<?php
$now = new DateTime;
$x = date_horiz_coord($now);
?>
<line x1="<?php echo $x ?>" y1="<?php echo $header_height ?>" x2="<?php echo $x ?>" y2="<?php echo $header_height + (count($branches) * $branch_height) ?>" />
<text x="<?php echo $x ?>" y="<?php echo $header_height + (count($branches) * $branch_height) + (0.8 * $footer_height) ?>">
<?php echo 'Today: '.$now->format('j M Y') ?>
</text>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 448 B

After

Width:  |  Height:  |  Size: 3.7 KiB

50
modeles/table.html

@ -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>

10
supportedversions_fonctions.php

@ -7,3 +7,13 @@ function supportedversions_insert_head_css($flux) {
return $flux;
}
function state(array $valeurs) {
//var_dump($valeurs);
$now = new DateTime;
return "stable"; //"eol", "security"
}
function active_branches() {
return $GLOBALS['RELEASES'];
}

Loading…
Cancel
Save