|
|
|
@ -212,32 +212,6 @@ class SupportedVersions
|
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Filtre sélectionnant les données des branches en fin de vie. |
|
|
|
|
* |
|
|
|
|
* @return array<mixed> les branches en fin de vie à afficher |
|
|
|
|
*/ |
|
|
|
|
public static function eoledBranches() { |
|
|
|
|
// @codeCoverageIgnoreStart |
|
|
|
|
if (!self::$config) { |
|
|
|
|
self::init(); |
|
|
|
|
} |
|
|
|
|
// @codeCoverageIgnoreEnd |
|
|
|
|
|
|
|
|
|
$now = self::$now->format('Y-m-d'); |
|
|
|
|
return array_reduce( |
|
|
|
|
self::$releases, |
|
|
|
|
function ($branches, $release) use ($now) { |
|
|
|
|
if ($release['eol'] != '' && $release['eol'] <= $now) { |
|
|
|
|
$branches[] = $release; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return $branches; |
|
|
|
|
}, |
|
|
|
|
[] |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Filtre fournissant un tableau de compatibilité SPIP/PHP. |
|
|
|
|
* |
|
|
|
@ -290,15 +264,7 @@ class SupportedVersions
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @codeCoverageIgnore |
|
|
|
|
* @return array<mixed> |
|
|
|
|
*/ |
|
|
|
|
public static function phpMatrixWithEol() { |
|
|
|
|
return self::phpMatrix(true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Filtre fournissant les informations de la branche liée à la release passée en parramètre. |
|
|
|
|
* Filtre fournissant les informations de la branche liée à la release passée en paramètre. |
|
|
|
|
* |
|
|
|
|
* - Si le paramètre ne correspond pas à un nommage de branch X.Y |
|
|
|
|
* ou si la branche X.Y n'existe pas : |
|
|
|
@ -337,6 +303,71 @@ class SupportedVersions
|
|
|
|
|
return $values; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Filtre fournissant les branches correspondant à un état de publication donné. |
|
|
|
|
* |
|
|
|
|
* l'état de publication doit correspondre à l'un des termes suivants: |
|
|
|
|
* future, stable, security, eol. |
|
|
|
|
* @see state() |
|
|
|
|
* |
|
|
|
|
* @param string $state l'état de publication souhaité |
|
|
|
|
* @return array<mixed> |
|
|
|
|
*/ |
|
|
|
|
public static function getBranchesFromState(string $state): array { |
|
|
|
|
// @codeCoverageIgnoreStart |
|
|
|
|
if (!self::$config) { |
|
|
|
|
self::init(); |
|
|
|
|
} |
|
|
|
|
// @codeCoverageIgnoreEnd |
|
|
|
|
|
|
|
|
|
$notPlannedBranch = [ |
|
|
|
|
'branch' => '', |
|
|
|
|
'initial_release' => '', |
|
|
|
|
'active_support' => '', |
|
|
|
|
'eol' => '', |
|
|
|
|
'php' => [], |
|
|
|
|
'releases' => [], |
|
|
|
|
]; |
|
|
|
|
|
|
|
|
|
$callable = function ($values) { |
|
|
|
|
return false; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
if ('future' === $state) { |
|
|
|
|
$callable = function ($values) { |
|
|
|
|
$initial = $values['initial_release'] ? new DateTime($values['initial_release']) : null; |
|
|
|
|
return $initial && $initial > self::$now; |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ('stable' === $state) { |
|
|
|
|
$callable = function ($values) { |
|
|
|
|
$initial = $values['initial_release'] ? new DateTime($values['initial_release']) : null; |
|
|
|
|
$bug = $values['active_support'] ? new DateTime($values['active_support']) : null; |
|
|
|
|
return $initial && $initial <= self::$now && (!$bug || $bug >= self::$now); |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ('security' === $state) { |
|
|
|
|
$callable = function ($values) { |
|
|
|
|
$bug = $values['active_support'] ? new DateTime($values['active_support']) : null; |
|
|
|
|
$security = $values['eol'] ? new DateTime($values['eol']) : null; |
|
|
|
|
return $bug && $bug <= self::$now && (!$security || $security >= self::$now); |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ('eol' === $state) { |
|
|
|
|
$callable = function ($values) { |
|
|
|
|
$security = $values['eol'] ? new DateTime($values['eol']) : null; |
|
|
|
|
return $security && $security < self::$now; |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$filteredBranches = array_filter(self::$releases, $callable); |
|
|
|
|
|
|
|
|
|
return empty($filteredBranches) ? [$notPlannedBranch] : array_values($filteredBranches); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//Calendar Part |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|