Compare commits

...

3 Commits

  1. 31
      src/Command/CoreListerVersions.php

31
src/Command/CoreListerVersions.php

@ -58,7 +58,6 @@ class CoreListerVersions extends Command {
* @param mixed $type
* @return array $liste
*/
public static function listerVersions(string $type = 'branches') {
$liste = [];
@ -89,6 +88,27 @@ class CoreListerVersions extends Command {
return $liste;
}
/**
* verifierVersionExiste
*
* @param string $version
* @return bool
*/
public static function verifierVersionExiste(string $version) {
$versions = array_merge_recursive(self::listerVersions('branches'), self::listerVersions('tags'));
if (in_array($version, $versions)) {
return true;
}
}
/**
* trouverVersionStable
*
* @param optional array $branches
* @param optional array $tags
* @return string dernier_tag_xy
*/
public static function trouverVersionStable(?array $branches = [], ?array $tags = []) {
if (empty($branches)) {
$branches = self::listerVersions('branches');
@ -139,11 +159,10 @@ class CoreListerVersions extends Command {
* @return string $version
*/
public static function trouverVersionInstallee() {
ob_start();
passthru('spip dl -i | awk -F "[-b ]+" \'/[0-9]+/{print $(NF-2)}\'');
$version_installee = ob_get_contents();
ob_end_clean();
if (lire_fichier('ecrire/inc_version.php', $inc)) {
preg_match('/\$spip_version_branche = \'(\d+.\d+.\d+)\';/', $inc, $matches);
return $version_installee;
return $matches[1];
}
}
}

Loading…
Cancel
Save