Ajout d'un test supplémentaire pour améliorer le rapport d'erreur

This commit is contained in:
Vincent Calame 2021-11-05 12:51:53 +01:00 committed by root
parent 1d46250de9
commit 270af63abc
2 changed files with 18 additions and 8 deletions

View File

@ -34,10 +34,15 @@ function action_importer_emission_dist($arg = null) {
$ogg_size = "";
$mp3_size = "";
try {
$jsonContents = file_get_contents("https://forge.april.org/libreavous/lav-outils/raw/branch/master/podcasts/config/lav-".$code_emission.".json");
$jsonUrl = "https://forge.april.org/libreavous/lav-outils/raw/branch/master/podcasts/config/lav-".$code_emission.".json";
$jsonContents = file_get_contents($jsonUrl);
if ($jsonContents === false) {
$erreurs[] = "Erreur d'accès au fichier JSON :".$jsonUrl;
} else {
$json = json_decode($jsonContents, true);
if (!$json) {
$erreurs[] = "JSON incorrect : https://forge.april.org/libreavous/lav-outils/raw/branch/master/podcasts/config/lav-".$code_emission.".json";
$erreurs[] = "JSON incorrect :".$jsonUrl;
}
}
} catch (Exception $e) {
$erreurs[] = $e->getMessage();

View File

@ -99,10 +99,15 @@ function libreavous_import_run($id_article) {
$ogg_size = "";
$mp3_size = "";
try {
$jsonContents = file_get_contents("https://forge.april.org/libreavous/lav-outils/raw/branch/master/podcasts/config/lav-".$code_emission.".json");
$jsonUrl = "https://forge.april.org/libreavous/lav-outils/raw/branch/master/podcasts/config/lav-".$code_emission.".json";
$jsonContents = file_get_contents($jsonUrl);
if ($jsonContents === false) {
$erreurs[] = "Erreur d'accès au fichier JSON :".$jsonUrl;
} else {
$json = json_decode($jsonContents, true);
if (!$json) {
$erreurs[] = "JSON incorrect : https://forge.april.org/libreavous/lav-outils/raw/branch/master/podcasts/config/lav-".$code_emission.".json";
$erreurs[] = "JSON incorrect :".$jsonUrl;
}
}
} catch (Exception $e) {
$erreurs[] = $e->getMessage();