Browse Source

feat(spip_loader): v2 for spip_loader v5 as default api version. previous v2 becomes v3

fix-api
JamesRezo 9 months ago
parent
commit
85056dda1a
  1. 12
      action/api_spip_loader.php
  2. 47
      modeles/supportedversions_spiploaderlist_2.html
  3. 31
      modeles/supportedversions_spiploaderlist_2_complement.html
  4. 62
      modeles/supportedversions_spiploaderlist_3.html
  5. 2
      supportedversions_options.php

12
action/api_spip_loader.php

@ -21,6 +21,18 @@ function action_api_spip_loader_dist(): void {
$reponse['versions'] = json_decode($modele, true);
}
if (2 === $api) {
$modele = recuperer_fond('modeles/supportedversions_spiploaderlist_' . $api.'_complement');
if ($modele) {
$reponse = array_merge($reponse, json_decode($modele, true));
}
}
$lastModified = stat(find_in_path('data/releases.json'));
// $lastModified = stat(find_in_path('data/pre_releases.json')); // best date when alpha is out
$lastModified = $lastModified['mtime'] ?? null;
$lastModified = DateTime::createFromFormat('U', $lastModified, new DateTimeZone('UTC'));
header('Last-Modified: '.$lastModified->format('D, d M Y H:i:s').' GMT');
header('Content-Type: application/json');
header('Access-Control-Allow-Origin: *');
echo json_encode($reponse);

47
modeles/supportedversions_spiploaderlist_2.html

@ -1,61 +1,32 @@
#SET{list, #ARRAY{dev, #ARRAY{
url, https://files.spip.net/spip/dev/spip-master.zip,
php, #LISTE{7.4,8.0,8.1}
}}
#SET{list, #ARRAY{dev,spip/dev/spip-master.zip}}
<BOUCLE_pre_releases(DATA){source json, #CHEMIN{data/pre_releases.json}}{branch=#VAL{future}|SupportedVersions::getBranchesFromState|table_valeur{0/branch}}>
<BOUCLE_releases(DATA){source table, #PRE_RELEASES}{par released_at}{inverse}{0,1}>
<BOUCLE_download(DATA){source table, #DOWNLOAD}>
#SET{release, #ARRAY{
url, #URL,
php, #VERSION|SupportedVersions::getBranchValues|table_valeur{technologies/require/php},
extensions, #VERSION|SupportedVersions::getBranchValues|table_valeur{technologies/require/php-ext},
ram, #VERSION|SupportedVersions::getBranchValues|table_valeur{system/ram},
freespace, #VERSION|SupportedVersions::getBranchValues|table_valeur{system/freespace},
sha1, #SHA1}}
</BOUCLE_download>
#SET{list, #GET{list}|array_merge{#ARRAY{#VERSION, #GET{release}}}}
<BOUCLE_download(DATA){source table, #DOWNLOAD}>#SET{file, #URL|replace{https://files.spip.net/}}</BOUCLE_download>
#SET{list, #GET{list}|array_merge{#ARRAY{#VERSION, #GET{file}}}}
</BOUCLE_releases>
</BOUCLE_pre_releases>
<BOUCLE_stable(DATA){source table, #VAL{stable}|SupportedVersions::getBranchesFromState}{par last_date_release}{inverse}{0,1}>
<BOUCLE_release_stable(DATA){source table, #RELEASES}{version=#LAST_VERSION_RELEASE}>
<BOUCLE_download_stable(DATA){source table, #DOWNLOAD}>
#SET{release, #ARRAY{
url, #URL,
php, #VERSION|SupportedVersions::getBranchValues|table_valeur{technologies/require/php},
extensions, #VERSION|SupportedVersions::getBranchValues|table_valeur{technologies/require/php-ext},
ram, #VERSION|SupportedVersions::getBranchValues|table_valeur{system/ram},
freespace, #VERSION|SupportedVersions::getBranchValues|table_valeur{system/freespace},
sha1, #SHA1}}
#SET{file, #URL|replace{https://files.spip.net/}}
</BOUCLE_download_stable>
#SET{list, #GET{list}|array_merge{#ARRAY{#VERSION, #GET{release}}}}
#SET{list, #GET{list}|array_merge{#ARRAY{#VERSION, #GET{file}}}}
</BOUCLE_release_stable>
</BOUCLE_stable>
<BOUCLE_security(DATA){source table, #VAL{security}|SupportedVersions::getBranchesFromState}{par last_date_release}{inverse}{0,1}>
<BOUCLE_release_security(DATA){source table, #RELEASES}{version=#LAST_VERSION_RELEASE}>
<BOUCLE_download_security(DATA){source table, #DOWNLOAD}>
#SET{release, #ARRAY{
url, #URL,
php, #VERSION|SupportedVersions::getBranchValues|table_valeur{technologies/require/php},
extensions, #VERSION|SupportedVersions::getBranchValues|table_valeur{technologies/require/php-ext},
ram, #VERSION|SupportedVersions::getBranchValues|table_valeur{system/ram},
freespace, #VERSION|SupportedVersions::getBranchValues|table_valeur{system/freespace},
sha1, #SHA1}}
#SET{file, #URL|replace{https://files.spip.net/}}
</BOUCLE_download_security>
#SET{list, #GET{list}|array_merge{#ARRAY{#VERSION, #GET{release}}}}
#SET{list, #GET{list}|array_merge{#ARRAY{#VERSION, #GET{file}}}}
</BOUCLE_release_security>
</BOUCLE_security>
<BOUCLE_eol(DATA){source table, #VAL{eol}|SupportedVersions::getBranchesFromState}{par last_date_release}{inverse}{0,1}>
<BOUCLE_release_eol(DATA){source table, #RELEASES}{version=#LAST_VERSION_RELEASE}>
<BOUCLE_download_eol(DATA){source table, #DOWNLOAD}>
#SET{release, #ARRAY{
url, #URL,
php, #VERSION|SupportedVersions::getBranchValues|table_valeur{technologies/require/php},
extensions, #VERSION|SupportedVersions::getBranchValues|table_valeur{technologies/require/php-ext},
ram, #VERSION|SupportedVersions::getBranchValues|table_valeur{system/ram},
freespace, #VERSION|SupportedVersions::getBranchValues|table_valeur{system/freespace},
sha1, #SHA1}}
#SET{file, #URL|replace{https://files.spip.net/}}
</BOUCLE_download_eol>
#SET{list, #GET{list}|array_merge{#ARRAY{#VERSION, #GET{release}}}}
#SET{list, #GET{list}|array_merge{#ARRAY{#VERSION, #GET{file}}}}
</BOUCLE_release_eol>
</BOUCLE_eol>
[(#GET{list}|json_encode)]

31
modeles/supportedversions_spiploaderlist_2_complement.html

@ -0,0 +1,31 @@
<BOUCLE_default_branch(DATA){source table, #VAL{stable}|SupportedVersions::getBranchesFromState}{par last_date_release}{inverse}{0,1}>
#SET{default_branch, #LAST_VERSION_RELEASE|substr{0, 3}}
</BOUCLE_default_branch>
#SET{php, #ARRAY{master, 7.4.0}}
<BOUCLE_pre_releases(DATA){source json, #CHEMIN{data/pre_releases.json}}{branch=#VAL{future}|SupportedVersions::getBranchesFromState|table_valeur{0/branch}}>
<BOUCLE_releases(DATA){source table, #PRE_RELEASES}{par released_at}{inverse}{0,1}>
#SET{php, #GET{php}|array_merge{#ARRAY{#VERSION, #VERSION|SupportedVersions::getBranchValues|table_valeur{technologies/require/php}|array_shift|concat{.0}}}}
</BOUCLE_releases>
</BOUCLE_pre_releases>
<BOUCLE_stable(DATA){source table, #VAL{stable}|SupportedVersions::getBranchesFromState}{par last_date_release}{inverse}{0,1}>
<BOUCLE_release_stable(DATA){source table, #RELEASES}{version=#LAST_VERSION_RELEASE}>
#SET{php, #GET{php}|array_merge{#ARRAY{#VERSION, #VERSION|SupportedVersions::getBranchValues|table_valeur{technologies/require/php}|array_shift|concat{.0}}}}
</BOUCLE_release_stable>
</BOUCLE_stable>
<BOUCLE_security(DATA){source table, #VAL{security}|SupportedVersions::getBranchesFromState}{par last_date_release}{inverse}{0,1}>
<BOUCLE_release_security(DATA){source table, #RELEASES}{version=#LAST_VERSION_RELEASE}>
#SET{php, #GET{php}|array_merge{#ARRAY{#VERSION, #VERSION|SupportedVersions::getBranchValues|table_valeur{technologies/require/php}|array_shift|concat{.0}}}}
</BOUCLE_release_security>
</BOUCLE_security>
<BOUCLE_eol(DATA){source table, #VAL{eol}|SupportedVersions::getBranchesFromState}{par last_date_release}{inverse}{0,1}>
<BOUCLE_release_eol(DATA){source table, #RELEASES}{version=#LAST_VERSION_RELEASE}>
#SET{php, #GET{php}|array_merge{#ARRAY{#VERSION, #VERSION|SupportedVersions::getBranchValues|table_valeur{technologies/require/php}|array_shift|concat{.0}}}}
</BOUCLE_release_eol>
</BOUCLE_eol>
#SET{complement, #ARRAY{
default_branch, #GET{default_branch},
requirements, #ARRAY{
php, #GET{php}}
}}
[(#GET{complement}|json_encode)]
#FILTRE{trim}

62
modeles/supportedversions_spiploaderlist_3.html

@ -0,0 +1,62 @@
#SET{list, #ARRAY{dev, #ARRAY{
url, https://files.spip.net/spip/dev/spip-master.zip,
php, #LISTE{7.4,8.0,8.1}
}}
<BOUCLE_pre_releases(DATA){source json, #CHEMIN{data/pre_releases.json}}{branch=#VAL{future}|SupportedVersions::getBranchesFromState|table_valeur{0/branch}}>
<BOUCLE_releases(DATA){source table, #PRE_RELEASES}{par released_at}{inverse}{0,1}>
<BOUCLE_download(DATA){source table, #DOWNLOAD}>
#SET{release, #ARRAY{
url, #URL,
php, #VERSION|SupportedVersions::getBranchValues|table_valeur{technologies/require/php},
extensions, #VERSION|SupportedVersions::getBranchValues|table_valeur{technologies/require/php-ext},
ram, #VERSION|SupportedVersions::getBranchValues|table_valeur{system/ram},
freespace, #VERSION|SupportedVersions::getBranchValues|table_valeur{system/freespace},
sha1, #SHA1}}
</BOUCLE_download>
#SET{list, #GET{list}|array_merge{#ARRAY{#VERSION, #GET{release}}}}
</BOUCLE_releases>
</BOUCLE_pre_releases>
<BOUCLE_stable(DATA){source table, #VAL{stable}|SupportedVersions::getBranchesFromState}{par last_date_release}{inverse}{0,1}>
<BOUCLE_release_stable(DATA){source table, #RELEASES}{version=#LAST_VERSION_RELEASE}>
<BOUCLE_download_stable(DATA){source table, #DOWNLOAD}>
#SET{release, #ARRAY{
url, #URL,
php, #VERSION|SupportedVersions::getBranchValues|table_valeur{technologies/require/php},
extensions, #VERSION|SupportedVersions::getBranchValues|table_valeur{technologies/require/php-ext},
ram, #VERSION|SupportedVersions::getBranchValues|table_valeur{system/ram},
freespace, #VERSION|SupportedVersions::getBranchValues|table_valeur{system/freespace},
sha1, #SHA1}}
</BOUCLE_download_stable>
#SET{list, #GET{list}|array_merge{#ARRAY{#VERSION, #GET{release}}}}
</BOUCLE_release_stable>
</BOUCLE_stable>
<BOUCLE_security(DATA){source table, #VAL{security}|SupportedVersions::getBranchesFromState}{par last_date_release}{inverse}{0,1}>
<BOUCLE_release_security(DATA){source table, #RELEASES}{version=#LAST_VERSION_RELEASE}>
<BOUCLE_download_security(DATA){source table, #DOWNLOAD}>
#SET{release, #ARRAY{
url, #URL,
php, #VERSION|SupportedVersions::getBranchValues|table_valeur{technologies/require/php},
extensions, #VERSION|SupportedVersions::getBranchValues|table_valeur{technologies/require/php-ext},
ram, #VERSION|SupportedVersions::getBranchValues|table_valeur{system/ram},
freespace, #VERSION|SupportedVersions::getBranchValues|table_valeur{system/freespace},
sha1, #SHA1}}
</BOUCLE_download_security>
#SET{list, #GET{list}|array_merge{#ARRAY{#VERSION, #GET{release}}}}
</BOUCLE_release_security>
</BOUCLE_security>
<BOUCLE_eol(DATA){source table, #VAL{eol}|SupportedVersions::getBranchesFromState}{par last_date_release}{inverse}{0,1}>
<BOUCLE_release_eol(DATA){source table, #RELEASES}{version=#LAST_VERSION_RELEASE}>
<BOUCLE_download_eol(DATA){source table, #DOWNLOAD}>
#SET{release, #ARRAY{
url, #URL,
php, #VERSION|SupportedVersions::getBranchValues|table_valeur{technologies/require/php},
extensions, #VERSION|SupportedVersions::getBranchValues|table_valeur{technologies/require/php-ext},
ram, #VERSION|SupportedVersions::getBranchValues|table_valeur{system/ram},
freespace, #VERSION|SupportedVersions::getBranchValues|table_valeur{system/freespace},
sha1, #SHA1}}
</BOUCLE_download_eol>
#SET{list, #GET{list}|array_merge{#ARRAY{#VERSION, #GET{release}}}}
</BOUCLE_release_eol>
</BOUCLE_eol>
[(#GET{list}|json_encode)]
#FILTRE{trim}

2
supportedversions_options.php

@ -5,7 +5,7 @@ $GLOBALS['supportedversions'] = [
/**
* Version de l'API pour le script spip_loader.php
*/
'spip_loader_api_default' => 1,
'spip_loader_api_default' => 2,
/**
* Partie mise en forme du calendrier au format SVG en pixels.
*

Loading…
Cancel
Save