|
|
|
@ -10,7 +10,7 @@
|
|
|
|
|
* @param string $flux |
|
|
|
|
* @return string |
|
|
|
|
*/ |
|
|
|
|
function supportedversions_insert_head_css($flux) { |
|
|
|
|
function supportedversions_insert_head_css(string $flux): string { |
|
|
|
|
$flux .= '<link rel="stylesheet" type="text/css" media="all" href="'. |
|
|
|
|
find_in_path('css/supported-versions.css'). |
|
|
|
|
'" />'."\n"; |
|
|
|
@ -26,7 +26,7 @@ function supportedversions_insert_head_css($flux) {
|
|
|
|
|
* @param string $flux |
|
|
|
|
* @return string |
|
|
|
|
*/ |
|
|
|
|
function supportedversions_header_prive_css($flux) { |
|
|
|
|
function supportedversions_header_prive_css(string $flux): string { |
|
|
|
|
return supportedversions_insert_head_css($flux); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -249,7 +249,7 @@ class SupportedVersions
|
|
|
|
|
* Si les versions en fin de vie sont demandées, la date de fin de vie |
|
|
|
|
* doit être fournie et inférieure à la date du jour |
|
|
|
|
* |
|
|
|
|
* @param bool $eol true si on souahite afficher les versions SPIP en fin de vie. |
|
|
|
|
* @param bool $eol true si on souhaite afficher les versions SPIP en fin de vie. |
|
|
|
|
* @return array<mixed> |
|
|
|
|
*/ |
|
|
|
|
public static function phpMatrix($eol = false) { |
|
|
|
@ -297,6 +297,46 @@ class SupportedVersions
|
|
|
|
|
return self::phpMatrix(true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Filtre fournissant les informations de la branche liée à la release passée en parramètre. |
|
|
|
|
* |
|
|
|
|
* - Si le paramètre ne correspond pas à un nommage de branch X.Y |
|
|
|
|
* ou si la branche X.Y n'existe pas : |
|
|
|
|
* On retourne un tableau de valeurs vide. |
|
|
|
|
* |
|
|
|
|
* - Sinon, on retourne toutes les données de la branche. |
|
|
|
|
* |
|
|
|
|
* @param string $release la version de la publication dont on souhaite récupérer les données de branche |
|
|
|
|
* @return array<mixed> |
|
|
|
|
*/ |
|
|
|
|
public static function getBranchValues(string $release): array { |
|
|
|
|
// @codeCoverageIgnoreStart |
|
|
|
|
if (!self::$config) { |
|
|
|
|
self::init(); |
|
|
|
|
} |
|
|
|
|
// @codeCoverageIgnoreEnd |
|
|
|
|
|
|
|
|
|
$values = [ |
|
|
|
|
'branch' => '', |
|
|
|
|
'initial_release' => '', |
|
|
|
|
'active_support' => '', |
|
|
|
|
'eol' => '', |
|
|
|
|
'php' => [], |
|
|
|
|
'releases' => [], |
|
|
|
|
]; |
|
|
|
|
if (preg_match('/^(\d+\.\d+)/', $release, $matches)) { |
|
|
|
|
$branch = $matches[1]; |
|
|
|
|
$filteredValues = array_filter(self::$releases, function ($values) use ($branch) { |
|
|
|
|
return $values['branch'] === $branch; |
|
|
|
|
}); |
|
|
|
|
if (!empty($filteredValues)) { |
|
|
|
|
$values = array_pop($filteredValues); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return $values; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//Calendar Part |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -389,7 +429,7 @@ class SupportedVersions
|
|
|
|
|
* |
|
|
|
|
* initial_release: |
|
|
|
|
* Une date au format 'Y-m-d' indiquant la date de sortie de la première release stable (X.Y.0) |
|
|
|
|
* Si la date est vide (''), la version n'a pas de date de sortie prévue, l'état est 'future' |
|
|
|
|
* Si la date est vide (''), la version n'a pas de date de sortie prévue, l'état est 'not-planned' |
|
|
|
|
* Si la date est supérieure à la date du jour, l'état est 'future' |
|
|
|
|
* Sinon elle est 'stable' |
|
|
|
|
* |
|
|
|
@ -414,12 +454,16 @@ class SupportedVersions
|
|
|
|
|
self::init(); |
|
|
|
|
} |
|
|
|
|
// @codeCoverageIgnoreEnd |
|
|
|
|
$state = 'future'; |
|
|
|
|
$state = 'not-planned'; |
|
|
|
|
|
|
|
|
|
$initial = $valeurs['initial_release'] ? new DateTime($valeurs['initial_release']) : null; |
|
|
|
|
$bug = $valeurs['active_support'] ? new DateTime($valeurs['active_support']) : null; |
|
|
|
|
$security = $valeurs['eol'] ? new DateTime($valeurs['eol']) : null; |
|
|
|
|
|
|
|
|
|
if ($initial && $initial > self::$now) { |
|
|
|
|
$state = 'future'; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ($initial && $initial <= self::$now) { |
|
|
|
|
$state = 'stable'; |
|
|
|
|
} |
|
|
|
|