Browse Source

modele table

merge-requests/1/head
JamesRezo 4 years ago
parent
commit
ef30e7465a
  1. 92
      inc/branches.php
  2. 9956
      inc/releases.php
  3. 130
      inc/version.php
  4. 4
      lang/supportedversions_en.php
  5. 4
      lang/supportedversions_fr.php
  6. 12
      modeles/table.html
  7. 19
      supportedversions_fonctions.php

92
inc/branches.php

@ -1,42 +1,5 @@
<?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
@ -281,61 +244,6 @@ function get_final_release($branch) {
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,

9956
inc/releases.php

File diff suppressed because it is too large Load Diff

130
inc/version.php

@ -1,130 +0,0 @@
<?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

4
lang/supportedversions_en.php

@ -1,14 +1,18 @@
<?php
$GLOBALS[$GLOBALS['idx_lang']] = [
'branch' => 'Branch',
'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_until' => 'Active Support Until',
'security_fix' => 'Security fixes only',
'security_fix_defintion' => 'A release that is supported for critical security issues only.
Releases are only made on an as-needed basis.',
'security_support_until' => 'Security Support Until',
'end_of_life' => 'End of life',
'end_of_life_definition' => 'A release that is no longer supported.
Users of this release should upgrade as soon as possible,
as they may be exposed to unpatched security vulnerabilities.',
'initial_release' => 'Initial Release',
];

4
lang/supportedversions_fr.php

@ -1,15 +1,19 @@
<?php
$GLOBALS[$GLOBALS['idx_lang']] = [
'branch' => 'Branche',
'active_support' => 'Active support',
'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.',
'active_support_until' => 'Prise en charge jusqu\'au',
'security_fix' => 'Security fixes only',
'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.',
'security_support_until' => 'Faille de sécurité jusqu\'au',
'end_of_life' => 'Fin de vie',
'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.',
'initial_release' => 'Première publication',
];

12
modeles/table.html

@ -2,16 +2,16 @@
<table class="standard">
<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>
<th><:supportedversions:branch:></th>
<th colspan="2"><:supportedversions:initial_release:></th>
<th colspan="2"><:supportedversions:active_support_until:></th>
<th colspan="2"><:supportedversions:security_support_until:></th>
</tr>
</thead>
<tbody>
<BOUCLE_active_branches(DATA){source csv, #CHEMIN{data/releases.csv}}{1,n}>
<tr>
<td class="[(#VALEUR|state)]">#BRANCH</td>
<tr[ class="(#VALEUR|state)"]>
<td>#BRANCH</td>
<td>[(#INITIAL_RELEASE|affdate)]</td>
<td class="collapse-phone">[<em>(#INITIAL_RELEASE|date_relative)</em>]</td>
<td>[(#ACTIVE_SUPPORT|affdate)]</td>

19
supportedversions_fonctions.php

@ -9,11 +9,20 @@ function supportedversions_insert_head_css($flux) {
}
function state(array $valeurs) {
//var_dump($valeurs);
$now = new DateTime;
return "stable"; //"eol", "security"
}
$initial = new DateTime($valeurs['initial_release']);
$bug = $valeurs['active_support'] ? new DateTime($valeurs['active_support']) : null;
$security = $valeurs['eol'] ? new DateTime($valeurs['eol']) : null;
if ($security && $now >= $security) {
return 'eol';
} elseif ($bug && $now >= $bug) {
return 'security';
} elseif ($now >= $initial) {
return 'stable';
} else {
return 'future';
}
function active_branches() {
return $GLOBALS['RELEASES'];
return '';
}

Loading…
Cancel
Save