Correction du nom de la chronique non traité
This commit is contained in:
parent
cbd6b6ced4
commit
9470f57bde
@ -28,6 +28,7 @@ function action_importer_emission_dist($arg = null) {
|
|||||||
return "Émission inconnue = ".$id_article;
|
return "Émission inconnue = ".$id_article;
|
||||||
}
|
}
|
||||||
$erreurs = array();
|
$erreurs = array();
|
||||||
|
$logs = array();
|
||||||
$json = false;
|
$json = false;
|
||||||
$podcast_duree = "";
|
$podcast_duree = "";
|
||||||
$ogg_size = "";
|
$ogg_size = "";
|
||||||
@ -36,7 +37,7 @@ function action_importer_emission_dist($arg = null) {
|
|||||||
$jsonContents = file_get_contents("https://forge.april.org/libreavous/lav-outils/raw/branch/master/podcasts/config/lav-".$code_emission.".json");
|
$jsonContents = file_get_contents("https://forge.april.org/libreavous/lav-outils/raw/branch/master/podcasts/config/lav-".$code_emission.".json");
|
||||||
$json = json_decode($jsonContents, true);
|
$json = json_decode($jsonContents, true);
|
||||||
if (!$json) {
|
if (!$json) {
|
||||||
$erreurs[] = "JSON incorrect";
|
$erreurs[] = "JSON incorrect : https://forge.april.org/libreavous/lav-outils/raw/branch/master/podcasts/config/lav-".$code_emission.".json";
|
||||||
}
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$erreurs[] = $e->getMessage();
|
$erreurs[] = $e->getMessage();
|
||||||
@ -125,6 +126,7 @@ function action_importer_emission_dist($arg = null) {
|
|||||||
'podcast_mp3' => $mp3_size,
|
'podcast_mp3' => $mp3_size,
|
||||||
'podcast_ogg' => $ogg_size
|
'podcast_ogg' => $ogg_size
|
||||||
);
|
);
|
||||||
|
$logs[] = sql_updateq("spip_articles", $emissionArray, "id_article=".$id_article,'','',false);
|
||||||
sql_updateq("spip_articles", $emissionArray, "id_article=".$id_article);
|
sql_updateq("spip_articles", $emissionArray, "id_article=".$id_article);
|
||||||
foreach ($chapitres as $chapitre) {
|
foreach ($chapitres as $chapitre) {
|
||||||
$code_chapitre = $chapitre["short_chapter_name"];
|
$code_chapitre = $chapitre["short_chapter_name"];
|
||||||
@ -145,14 +147,29 @@ function action_importer_emission_dist($arg = null) {
|
|||||||
if ($chapitreExistant and sql_count($chapitreExistant)>0) {
|
if ($chapitreExistant and sql_count($chapitreExistant)>0) {
|
||||||
$r = sql_fetch($chapitreExistant);
|
$r = sql_fetch($chapitreExistant);
|
||||||
$id_chapitre = $r["id_chapitre"];
|
$id_chapitre = $r["id_chapitre"];
|
||||||
|
$logs[] = sql_updateq("spip_chapitres", $chapitreArray, "id_chapitre=".$id_chapitre,'','',false);
|
||||||
sql_updateq("spip_chapitres", $chapitreArray, "id_chapitre=".$id_chapitre);
|
sql_updateq("spip_chapitres", $chapitreArray, "id_chapitre=".$id_chapitre);
|
||||||
} else {
|
} else {
|
||||||
|
$logs[] = sql_insertq("spip_chapitres", $chapitreArray, '', '', false);
|
||||||
$id_nouveau_chapitre = sql_insertq("spip_chapitres", $chapitreArray);
|
$id_nouveau_chapitre = sql_insertq("spip_chapitres", $chapitreArray);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$texteReponse = "Émission traitée : ". $code_emission;
|
$texteReponse = "<p>Émission traitée : ". $code_emission." / ".$titre_emission."</p>";
|
||||||
if (count($erreurs) > 0) {
|
if (count($erreurs) > 0) {
|
||||||
$texteReponse .= "<br><br>Erreurs : <br>".implode(" <br> ", $erreurs);
|
$texteReponse .= "<h2>Erreurs</h2>";
|
||||||
|
$texteReponse .= "<ul>";
|
||||||
|
foreach ($erreurs as $erreur) {
|
||||||
|
$texteReponse .= "<li><p>".$erreur."</p></li>";
|
||||||
|
}
|
||||||
|
$texteReponse .= "</ul>";
|
||||||
|
}
|
||||||
|
if (count($logs) > 0) {
|
||||||
|
$texteReponse .= "<h2>Requêtes effectuées</h2>";
|
||||||
|
$texteReponse .= "<ul>";
|
||||||
|
foreach ($logs as $log) {
|
||||||
|
$texteReponse .= "<li><p>".$log."</p></li>";
|
||||||
|
}
|
||||||
|
$texteReponse .= "</ul>";
|
||||||
}
|
}
|
||||||
// return $texteReponse;
|
// return $texteReponse;
|
||||||
ajax_retour($texteReponse, false);
|
ajax_retour($texteReponse, false);
|
||||||
@ -205,6 +222,7 @@ function libreavous_import_checkType($chapitre) {
|
|||||||
if ($idx === 0) {
|
if ($idx === 0) {
|
||||||
$result[] = "CH";
|
$result[] = "CH";
|
||||||
$nom_chronique = substr($code, strlen("chronique-"));
|
$nom_chronique = substr($code, strlen("chronique-"));
|
||||||
|
$result[] = $nom_chronique;
|
||||||
} else {
|
} else {
|
||||||
$result[] = "SC";
|
$result[] = "SC";
|
||||||
}
|
}
|
||||||
|
@ -286,6 +286,7 @@ function libreavous_import_checkType($chapitre) {
|
|||||||
if ($idx === 0) {
|
if ($idx === 0) {
|
||||||
$result[] = "CH";
|
$result[] = "CH";
|
||||||
$nom_chronique = substr($code, strlen("chronique-"));
|
$nom_chronique = substr($code, strlen("chronique-"));
|
||||||
|
$result[] = $nom_chronique;
|
||||||
} else {
|
} else {
|
||||||
$result[] = "SC";
|
$result[] = "SC";
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user