Affichage des requêtes réalisées
This commit is contained in:
parent
40b2fc0c2a
commit
98c4b5752e
@ -81,10 +81,11 @@ function balise_LIBREAVOUS_IMPORT($p) {
|
||||
|
||||
function libreavous_import_run($id_article) {
|
||||
$id_article = intval($id_article);
|
||||
$existant = sql_select("podcast_code","spip_articles","id_article=".$id_article);
|
||||
$existant = sql_select("podcast_code,titre","spip_articles","id_article=".$id_article);
|
||||
if ($existant and sql_count($existant)>0) {
|
||||
$r = sql_fetch($existant);
|
||||
$code_emission = $r["podcast_code"];
|
||||
$titre_emission = $r["titre"];
|
||||
if(strlen($code_emission) == 0) {
|
||||
return "Le code de l'émission n'est pas renseigné";
|
||||
}
|
||||
@ -92,6 +93,7 @@ function libreavous_import_run($id_article) {
|
||||
return "Émission inconnue = ".$id_article;
|
||||
}
|
||||
$erreurs = array();
|
||||
$logs = array();
|
||||
$json = false;
|
||||
$podcast_duree = "";
|
||||
$ogg_size = "";
|
||||
@ -189,6 +191,7 @@ function libreavous_import_run($id_article) {
|
||||
'podcast_mp3' => $mp3_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);
|
||||
foreach ($chapitres as $chapitre) {
|
||||
$code_chapitre = $chapitre["short_chapter_name"];
|
||||
@ -209,14 +212,29 @@ function libreavous_import_run($id_article) {
|
||||
if ($chapitreExistant and sql_count($chapitreExistant)>0) {
|
||||
$r = sql_fetch($chapitreExistant);
|
||||
$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);
|
||||
} else {
|
||||
$logs[] = sql_insertq("spip_chapitres", $chapitreArray, '', '', false);
|
||||
$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) {
|
||||
$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;
|
||||
}
|
||||
|
@ -3,7 +3,6 @@
|
||||
<title>Import</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>
|
||||
#LIBREAVOUS_IMPORT{#ENV{id_article}}
|
||||
</body>
|
||||
</html>
|
||||
|
Loading…
Reference in New Issue
Block a user